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 struggled with the same problem just a minute ago. My project was generated using the v 1.6.0 of angular-cli.

  1. npm update -g @angular/cli
  2. editing my package.json changing the line "@angular/cli": "1.6.0", to "@angular/cli": "^1.6.0",
  3. npm update did the trick.

LarsMengel avatar Jan 21 '18 17:01 LarsMengel

gosh thank you @LarsMengel :D That did it.

ghost avatar Jan 21 '18 17:01 ghost

I have the same issue with version 1.6.4. @LarsMengle this works because latest patch version is used 1.6.5. My problem is that 1.6.5 increased the prod build from 9minutes to 30 minutes

elvirdolic avatar Jan 21 '18 17:01 elvirdolic

Thanks @LarsMengel , I am struggling from last 2 days. Now the issue resolved!!

chandrarao22 avatar Jan 21 '18 18:01 chandrarao22

The same with my 1.5.2 version.

atereshkov avatar Jan 21 '18 21:01 atereshkov

I just started learning Angular a few days ago and this came up for the first time just now. Thanks @LarsMengel !

jlam55555 avatar Jan 21 '18 22:01 jlam55555

Thank you @LarsMengel! Just ran into the same thing with 1.6.4. Solution worked like a charm.

brianjb-lfl avatar Jan 21 '18 23:01 brianjb-lfl

I am using angular 1.6.5 for cli. In the examples from angular documentation: https://angular.io/tutorial/toh-pt6

In my package.json I change

original:

"@angular/cli": "1.5.0",

new:

"@angular/cli": "^1.5.0",

What does the "^" do exactly?

jadeite100 avatar Jan 22 '18 03:01 jadeite100

@jadeite100: Check out this link.

Excerpt:

So if you see ~1.0.2 it means to install version 1.0.2 or the latest patch version such as 1.0.4. If you see ^1.0.2 it means to install version 1.0.2 or the latest minor or patch version such as 1.1.0.

jlam55555 avatar Jan 22 '18 04:01 jlam55555

Thank you @LarsMengel.

samu1997 avatar Jan 22 '18 06:01 samu1997

@LarsMengel. Thanks alot, Its works for me..

ganeshanr12 avatar Jan 22 '18 07:01 ganeshanr12

@LarsMengel thank you very much. Was stuck few hours this morning trying to do this with VSTS

ghost avatar Jan 22 '18 07:01 ghost

Was this issue from yesterday onwards because we do see that this error is poping up suddenly from today?

kkajdd avatar Jan 22 '18 08:01 kkajdd

Seems so. I suspect for some reasons "angular-devkit/core" hasn´t been downloaded during the "ng new" process. Updating all the packages did the trick. Would be interesting to know the reason.

LarsMengel avatar Jan 22 '18 10:01 LarsMengel

Yes for us just updating @angular/cli did the trick

kkajdd avatar Jan 22 '18 10:01 kkajdd

Solved by updating to 1.6.5

psmyrdek avatar Jan 22 '18 10:01 psmyrdek

Does anybody have the link to download the code for the book? I brought the "ng-book: The Complete Guide to Angular 4 " on amazon.com but I can't see any link to download the code for the book?

jadeite100 avatar Jan 22 '18 12:01 jadeite100

Dude, I just wanted to thank you. I faced this similar error using CLI version 1.6.4, but using your instructions and updating to CLI 1.6.5, the error was gone and I got successful compilation. Thank you, sir!

Dagonium avatar Jan 22 '18 14:01 Dagonium

Thanks @LarsMengel that solution worked out for me. 👍

lawmbass avatar Jan 22 '18 15:01 lawmbass

thanks @LarsMengel had same problem and that fixed it.

gerrymcdonnell avatar Jan 22 '18 15:01 gerrymcdonnell