Angular-cli报错的解决办法

全局安装cli的命令行,可以任意地方创建项目。:::也会生成cli的局部依赖。

另请注意:查看package.json中的内容。如:devDependencies,这个模块。


1、我的产生环境:我创建的项目,误删除了以下模块,故产生报错

解决办法:"npm install --save-dev @angular/compiler-cli" 


产生原因:package.json的devDependencies内部,没有@angular/compiler-cli(npm包的安装分为全局与局部安装,这种出现在局部安装中)
The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.
at Object.<anonymous> (/home/lfy/drweb/client/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> (/home/lfy/drweb/client/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)

解决办法:npm install --save-dev @angular/compiler-cli


2、我的产生环境:我创建的项目,误删除了以下模块,故产生报错

解决办法:"npm install --save-dev @angular/cli@latest" 
产生原因:package.json的devDependencies内部,没有@angular/cli(npm包的安装分为全局与局部安装,这种出现在局部安装中)
Unable to find "@angular/cli" in devDependencies.

Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest" 

You have to be inside an Angular CLI project in order to use the serve command.  (他告诉你应该在cli的项目内,运行 ng serve命令。他不知道这是个cli的项目)



3、更新angular-cli为最新版本

  
  
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest




评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值