[英]Error in ng serve after installing npm angular/cli
I am a beginner in learning nodejs and angular.我是学习 nodejs 和 angular 的初学者。 I have installed node and created a node project which was working fine.
我已经安装了节点并创建了一个运行良好的节点项目。 Then I did "npm install -g angular-cli" and after that i did ng new client and inside client when i do "ng serve" i am getting the following error:
然后我做了“npm install -g angular-cli”,之后我做了新客户端和内部客户端,当我做“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:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\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:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\models\webpack-configs\typescript.js:3:17)
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:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\models\webpack-configs\index.js:9:10)
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:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\models\webpack-config.js:4:25)
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:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\tasks\serve.js:11:24)
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:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\commands\serve.run.js:6:15)
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 Class.run (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\commands\serve.js:67:16)
at Class.<anonymous> (C:\Users\Subhasree\AppData\Roaming\npm\node_modules\angular-cli\ember-cli\lib\models\command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:109:7)
You may have older versions.您可能有旧版本。
See the instructions here and see if that helps: https://github.com/angular/angular-cli/wiki/stories-1.0-update请参阅此处的说明,看看是否有帮助: https : //github.com/angular/angular-cli/wiki/stories-1.0-update
The steps are basically:步骤基本上是:
The link provides specifics for each of these steps along with appropriate commands.该链接提供了每个步骤的详细信息以及相应的命令。
Here is a simple solution to that and it works like charm.这是一个简单的解决方案,它就像魅力一样。
cd
into your project directory cd client
. cd
进入你的项目目录cd client
。
Run npm install
or yarn install
, wait for it to successfully execute运行
npm install
或yarn install
,等待执行成功
Run your ng serve
.运行你的
ng serve
。
I hope this helps and much more easier我希望这会有所帮助并且更容易
Run these two commands:运行这两个命令:
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
尝试运行这个: npm install --save-dev @angular/cli@latest
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.