angular2-cli – 找不到模块’./models/config’

前端之家收集整理的这篇文章主要介绍了angular2-cli – 找不到模块’./models/config’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
将我的Angular 2 CLI项目从1.0.0-beta.11-webpack.2更新到1.0.0-beta.11-webpack.8 according to instructions

npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@webpack

结果如下:

jan@linux-zd16:~/src/fm-repos/fm-ui> ng --version
Cannot find module './models/config'
Error: Cannot find module './models/config'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/addon/ng2/index.js:4:16)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

解决方法

安装Angular CLI时,请显式使用最新版本:

更新全局Angular CLI

rm -rf node_modules dist tmp
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest

更新项目的Angular CLI

npm install --save-dev angular-cli@latest

更新项目的配置文件

ng init

并仔细审查每个差异.

猜你在找的Angularjs相关文章