0

After updating my @angular 2.0.1 application's [email protected] to [email protected], the ng init fails with:

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)

Update procedure:

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

followed by in my project directory:

rm -rf node_modules dist tmp
npm install --save-dev angular-cli@latest
ng init                                         <-- failure here

1 Answer 1

0

Downgrade the project's @angular from 2.0.1 to 2.0.0 by editing package.json, then:

rm -rf node_modules
npm install

Then ng init works, again; and then, you can upgrade to @angular 2.0.1.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.