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

Only need run 👍 : npm i -D @angular-devkit/core

tienthanhjlw avatar Jan 22 '18 17:01 tienthanhjlw

@tienthanhjlw solution fixed the issue, I am using CLI 1.6.4

adil-boukdair avatar Jan 22 '18 20:01 adil-boukdair

@tienthanhjlw fixed for me too, I am using v1.6.3

raphaelbluteau avatar Jan 23 '18 00:01 raphaelbluteau

@tienthanhjlw yes that worked too!

gerrymcdonnell avatar Jan 23 '18 00:01 gerrymcdonnell

@tienthanhjlw Thanks, it worked for me!

bobbypulpel avatar Jan 23 '18 02:01 bobbypulpel

Thank you @LarsMengel. It worked for me

aman119 avatar Jan 23 '18 07:01 aman119

Thankyou @LarsMengel

pranesh239 avatar Jan 23 '18 09:01 pranesh239

An update to version 1.6.5 seems to fix the issue npm update -g @angular/cli

Angular CLI: 1.6.5 Node: 6.11.3 OS: win32 x64 Angular: 5.2.1 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

@angular/cdk: 5.1.0 @angular/cli: 1.6.5 @angular/material: 5.1.0 @angular-devkit/build-optimizer: 0.0.41 @angular-devkit/core: 0.0.28 @angular-devkit/schematics: 0.0.51 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.9.5 @schematics/angular: 0.1.16 typescript: 2.5.3 webpack: 3.10.0

adil-boukdair avatar Jan 23 '18 12:01 adil-boukdair

Yep, updating to 1.6.5 fixed it for me as well (I updated the local package via package.json and it was enough, for me at least) Thanks @adil-boukdair

shairez avatar Jan 23 '18 13:01 shairez

@LarsMengel your Solution works for me, Thanks

naadydev avatar Jan 24 '18 09:01 naadydev

ERROR in Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options. at Object.resolveEntryModuleFromMain (C:........\node_modules@ngtools\webpack\src\entry_resolver.js:131:11) at Promise.resolve.then.then (C:........\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:240:54) at at process._tickCallback (internal/process/next_tick.js:188:7)

Can you help me?

AulonaBinaj avatar Jan 24 '18 16:01 AulonaBinaj

@LarsMengel, Thanks

Nditah avatar Jan 24 '18 20:01 Nditah

this is correct solution

npm install @angular-devkit/core --save-dev

https://github.com/angular/devkit/issues/256

inyee786 avatar Jan 25 '18 18:01 inyee786

Changing "@angular/cli": "1.5.0" to "@angular/cli": "^1.5.0" fixed my issue as well. Many thanks @LarsMengel . Appreciate your help.

For anyone looking what it actually meant:

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.

Source: https://michaelsoolee.com/npm-package-tilde-caret/

ediganeelima avatar Jan 25 '18 18:01 ediganeelima

Thanks @LarsMengel

roshan092 avatar Jan 26 '18 03:01 roshan092

Update ng version to latest version -

npm update -g @angular/cli

yogpande avatar Jan 26 '18 04:01 yogpande

Thanks @LarsMengel I had to re-run npm install and problem solved. The reason being i was getting error "Your global Angular CLI version is greater than your local" while running npm update.

rahul230691 avatar Jan 26 '18 07:01 rahul230691

Thanks LarsMengel, very useful. A small change in my case. npm update did not work on the already created project. Had to use npm install.

ganga-ai avatar Jan 26 '18 17:01 ganga-ai

Thanks @LarsMengel

afatihk avatar Jan 26 '18 20:01 afatihk

Thankyou @LarsMengel. Just ran into this issue and your solution solved everything in a sec :)

alinaalam avatar Jan 27 '18 10:01 alinaalam