angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Error: Cannot find module '@angular-devkit/core' - after clean install

Open ghost opened this issue 8 years ago • 113 comments

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

ghost avatar Jan 21 '18 16:01 ghost

I had the same Problem. I solved by below command npm update -g @angular/cli

dinesh1290 avatar Mar 16 '18 11:03 dinesh1290

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: 👍

Luis-DevOps avatar Mar 22 '18 18:03 Luis-DevOps

@tienthanhjlw yes that worked too!

sandeepkamathkr avatar Mar 23 '18 12:03 sandeepkamathkr

Thanks @LarsMengel, updating to ng-cli 1.7 fixed it for me

KovNull avatar Mar 24 '18 10:03 KovNull

Thanks @LarsMengel .*

naqashse102 avatar Mar 24 '18 18:03 naqashse102

Thank you @LarsMengel it worked for me as well

kedarsc avatar Mar 29 '18 04:03 kedarsc

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?

jdhines avatar Mar 30 '18 16:03 jdhines

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

edgeineer avatar Apr 03 '18 03:04 edgeineer

@LarsMengel Great. Did the trick. Thanks man

hemantsan avatar Apr 20 '18 11:04 hemantsan

fixed issue for me @pmesserschmidt

nidhivc avatar Apr 24 '18 05:04 nidhivc

@tienthanhjlw thanks !

yuehernkang avatar Apr 27 '18 09:04 yuehernkang

@LarsMengel, Thanks

DerejeKitaw avatar May 04 '18 18:05 DerejeKitaw

Thank you, genius!

rogerandreeta avatar May 05 '18 10:05 rogerandreeta

@LarsMengel thank you very much, i've never faced the problem before. your solution still works!

natanaelfonseca avatar May 05 '18 17:05 natanaelfonseca

@LarsMengel thanks mate. worked great

mikerames avatar May 07 '18 01:05 mikerames

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

melroy89 avatar May 12 '18 01:05 melroy89

Thank you @LarsMengel

pedrodominguesp avatar May 27 '18 23:05 pedrodominguesp

Thanks a lot..! It worked..!!!

NivethaH avatar Jun 06 '18 09:06 NivethaH

Having an old project (e.g. 1.5.4):

npm install

Folder node_modules/@angular-devkit/core is there

npm install @angular/cli

Folder node_modules/@angular-devkit/core is 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/core is there again! 👍

Now ng update @angular/cli will work as expected.

JohannesHoppe avatar Jun 10 '18 20:06 JohannesHoppe

npm i npm@latest -g

niubenben avatar Jun 28 '18 02:06 niubenben