Error: Cannot find module '@angular-devkit/core' - after clean install
Versions
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.4
Node: 6.11.0
OS: win32 x64
Angular: _(yup, I don't see it, but I install it 2 days ago)_
...
Repro steps
- ng new e-commerce-with-tut-ng4
- cd e-commerce-with-tut-ng-4
- ng serve (to test if works)
Observed behavior
After that I've got this ->
C:\Users\TheTanadu\Desktop\codetemp\e-commerce-with-tut-ng4>ng serve
module.js:471
throw err;
^
Error: Cannot find module '@angular-devkit/core'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\TheTanadu\Desktop\codetemp\e-commerce-with-tut-ng4\node_modules\@angular-devkit\schematics\src\tree\virtual.js:10:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
After all I came here but when I wanted to use ng --version in this path I've got same error like that what is up and I had to go cd .. and then use ng -v
Desired behavior
I wanted to see local server
Mention any other details that might be useful (optional)
Windows 10
I had the same Problem. I solved by below command npm update -g @angular/cli
I had angular 1.6.6 and experienced this issue. My package.json was ^1.6.1. I fixed it by removing @angular/cli, cleaned the npm cache and installed @angular/cli again. Steps bellow:
npm uninstall -g @angular/cli npm cache clean npm install -g @angular/cli
Good luck: 👍
@tienthanhjlw yes that worked too!
Thanks @LarsMengel, updating to ng-cli 1.7 fixed it for me
Thanks @LarsMengel .*
Thank you @LarsMengel it worked for me as well
Hang on now. So obviously, updating angular-cli fixes the issue, but it appears that 1.5.0 to 1.6.4 suffered this problem. How did so many versions get released that wouldn't even ng serve?
ha, ty guys.... kept following all the comments and tada some magic happens and it is fixed now...
I did npm install @angular-devkit/core also
added them to package json manually
"@angular-devkit/core": "0.4.8", and did npm update
@LarsMengel Great. Did the trick. Thanks man
fixed issue for me @pmesserschmidt
@tienthanhjlw thanks !
@LarsMengel, Thanks
Thank you, genius!
@LarsMengel thank you very much, i've never faced the problem before. your solution still works!
@LarsMengel thanks mate. worked great
I think the correct way is to add the following to the dev-deps:
"@angular-devkit/build-angular": "^0.6.1",
Or execute: npm install --save-dev @angular-devkit/build-angular
Thank you @LarsMengel
Thanks a lot..! It worked..!!!
Having an old project (e.g. 1.5.4):
npm install
Folder
node_modules/@angular-devkit/coreis there
npm install @angular/cli
Folder
node_modules/@angular-devkit/coreis gone! 😕
Now ng update @angular/cli has no chance at all and will fail:
ng update @angular/cli
module.js:557
throw err;
^
Error: Cannot find module '@angular-devkit/core'
Simplest possible solution. Do this AGAIN:
npm install @angular/cli
Folder
node_modules/@angular-devkit/coreis there again! 👍
Now ng update @angular/cli will work as expected.
npm i npm@latest -g