Angular-cli: Cannot find module '@angular/core' after new update

Created on 22 Oct 2016  路  6Comments  路  Source: angular/angular-cli

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OSX El Capitan

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node -- version and paste the result here:

Can't run any ng commands all same error

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Updated the cli from beta 14 to beta 18 using all 6 steps.
ng init and all other ng commands give me "Cannot find module '@angular/core'"

The log given by the failure.

Normally this include a stack trace and some more information.

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.
....

Mention any other details that might be useful.

Most helpful comment

Just encountered this issue as well.
To fix: run npm install and try again.

All 6 comments

Just encountered this issue as well.
To fix: run npm install and try again.

@shicechi Thanks for the reply. I just did that after deleting the node_modules. It does work now but I never ran the ng init command. Did you do that, hopefully it doesn't cause future problems?

@keithmichelson I did run the ng init command though. But instead of skipping all the file checks, inspect each by typing in d to see the difference and modify the files accordingly. Some config files do actually need a override for this update. I so far haven't encountered any other problems but I could be wrong.

@shicechi Thanks, I just went through and did the same just to make sure, luckily that command worked after the npm install.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings