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. (/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. (/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




你可能感兴趣的:(angular2.0,问题)