将我的@angular
2.0.1
应用程序angular-cli@1.0.0-beta.15
更新为angular-cli@1.0.0-beta.16
后,ng init
失败并显示:
Cannot find module '@angular/core'
Error: Cannot find module '@angular/core'
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/@ngtools/webpack/src/plugin.js:4:14)
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)
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/@ngtools/webpack/src/index.js:6:10)
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)
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/models/webpack-build-typescript.js:5:17)
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)
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/models/webpack-config.js:2:34)
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)
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/tasks/build-webpack.js:6:24)
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)
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/commands/build.js:3:23)
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)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Class.includedCommands (/home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/addon/index.js:20:16)
at /home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/lib/models/project.js:392:61
at Array.forEach (native)
at Project.addonCommands (/home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/lib/models/project.js:391:15)
at Project.eachAddonCommand (/home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/lib/models/project.js:426:30)
at module.exports (/home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/lib/cli/lookup-command.js:33:13)
at CLI.<anonymous> (/home/jan/src/fm-repos/fm-ui/node_modules/angular-cli/lib/cli/cli.js:34:26)
at tryCatch (/home/jan/src/fm-repos/fm-ui/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/home/jan/src/fm-repos/fm-ui/node_modules/rsvp/dist/rsvp.js:553:13)
at publish (/home/jan/src/fm-repos/fm-ui/node_modules/rsvp/dist/rsvp.js:521:7)
at flush (/home/jan/src/fm-repos/fm-ui/node_modules/rsvp/dist/rsvp.js:2370:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
更新程序:
ng --version
angular-cli: 1.0.0-beta.15
node: 6.5.0
os: linux x64
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
然后在我的项目目录中:
rm -rf node_modules dist tmp
npm install --save-dev angular-cli@latest
ng init <-- failure here
答案 0 :(得分:0)
通过修改@angular
,将项目的2.0.1
从2.0.0
降级为package.json
,然后:
rm -rf node_modules
npm install
然后ng init
再次起作用;然后,您可以升级到@angular 2.0.1
。