Error: Cannot find module '@angular/core'

Jan Nielsen

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
Jan Nielsen

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error: Cannot find module './'

From Dev

Error: Cannot find module 'commander'

From Dev

Error: Cannot find module 'mongodb'

From Javascript

Error: Cannot find module html

From Dev

Error: Cannot find module './args'

From Dev

Phonegap error: Cannot find module

From Dev

NPM - Error: Cannot find module '../'

From Dev

Error: Cannot find module 'libxmljs'

From Dev

Error: Cannot find module './development'

From Dev

Error: Cannot find module './algs'

From Dev

Error: Cannot find module 'ms'

From Dev

Error: Cannot find module './pulp'

From Dev

Error: Cannot find module ' in Protractor

From Dev

Error: Cannot find module 'cors'

From Dev

TypeScript cannot find module error

From Dev

Error: Cannot find module 'togeojson'

From Dev

Error - Cannot find module 'broccoli'

From Dev

Error: Cannot find module './lodash'

From Dev

Error: Cannot find module 'AsyncDependencyToInitialChunkWarning'

From Dev

Error: Cannot find module 'transformer-module'

From Dev

error 'MODULE NOT FOUND', Cannot find module

From Dev

Error: Error: Cannot find module ' in angular js?

From Dev

Error: Cannot find module 'app/MyComponent/MyComponent.module' Error: Cannot find module

From Dev

Heroku error: 'cannot find module 'express'

From Dev

TypeScript error: Cannot find module 'moment'

From Dev

After Firebase deploy - Error: cannot find module

From Dev

Cannot find Python error "ImportError: No module"

From Dev

Parsing error : Cannot find module 'next/babel'

From Dev

Error when run the test "Cannot find module "

From Dev

Uncaught Error: Cannot find module "./RandomWords"