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
Only need run 👍 :
npm i -D @angular-devkit/core
@tienthanhjlw solution fixed the issue, I am using CLI 1.6.4
@tienthanhjlw fixed for me too, I am using v1.6.3
@tienthanhjlw yes that worked too!
@tienthanhjlw Thanks, it worked for me!
Thank you @LarsMengel. It worked for me
Thankyou @LarsMengel
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
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
@LarsMengel your Solution works for me, Thanks
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
Can you help me?
@LarsMengel, Thanks
this is correct solution
npm install @angular-devkit/core --save-dev
https://github.com/angular/devkit/issues/256
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/
Thanks @LarsMengel
Update ng version to latest version -
npm update -g @angular/cli
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.
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.
Thanks @LarsMengel
Thankyou @LarsMengel. Just ran into this issue and your solution solved everything in a sec :)