当我因某种原因尝试安装新软件包时,npm会删除与angular cli相关的所有软件包。 当我重新安装angular cli时,我收到以下错误消息:
C:\SomeApp\Main\WebUI>ng serve
The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.
at Object.<anonymous> (C:\SomeApp\Main\WebUI\node_modules\@ngtools\webpack\src\index.js:14:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\SomeApp\Main\WebUI\node_modules\@angular\cli\tasks\eject.js:10:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19
答案 0 :(得分:0)
遇到此问题时,您可以先尝试更新角度cli。
https://github.com/angular/angular-cli#updating-angular-cli
请务必运行此命令。
还要确保这是package.json文件中的依赖项,例如
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
希望它有所帮助..
答案 1 :(得分:-1)
我昨天刚遇到同样的错误。在尝试了几乎所有可能的解决方案一天后,对我有用的是:npm install -g -f angular-cli
它将用@ angular-cli替换@ angular / cli来解决现在的问题,然后你可以将它更新到新版本。另请在此问题上查看this link as it has great info。