2016-09-29 84 views
0

更新我@angular2.0.1應用程序的[email protected][email protected]後,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 [email protected] 

其次在我的項目目錄中:

rm -rf node_modules dist tmp 
npm install --save-dev [email protected] 
ng init           <-- failure here 

回答

0

降級項目的@angular2.0.12.0.0通過編輯package.json,則:

rm -rf node_modules 
npm install 

然後ng init作品,再次;然後,您可以升級到@angular 2.0.1