New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this Issue Jan 21, 2018 · 111 comments

Comments

Projects
None yet
@ghost
Copy link

ghost commented Jan 21, 2018

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

@LarsMengel

This comment has been minimized.

Copy link

LarsMengel commented Jan 21, 2018

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.
@ghost

This comment has been minimized.

Copy link

ghost commented Jan 21, 2018

gosh thank you @LarsMengel :D That did it.

@ghost ghost closed this Jan 21, 2018

@elvirdolic

This comment has been minimized.

Copy link

elvirdolic commented Jan 21, 2018

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

@chandrarao22

This comment has been minimized.

Copy link

chandrarao22 commented Jan 21, 2018

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

@atereshkov

This comment has been minimized.

Copy link

atereshkov commented Jan 21, 2018

The same with my 1.5.2 version.

atereshkov pushed a commit to atereshkov/DiberWebClient that referenced this issue Jan 21, 2018

@jlam55555

This comment has been minimized.

Copy link

jlam55555 commented Jan 21, 2018

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

@brianjb-lfl

This comment has been minimized.

Copy link

brianjb-lfl commented Jan 21, 2018

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

@jadeite100

This comment has been minimized.

Copy link

jadeite100 commented Jan 22, 2018

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?

@jlam55555

This comment has been minimized.

Copy link

jlam55555 commented Jan 22, 2018

@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.

@samu1997

This comment has been minimized.

Copy link

samu1997 commented Jan 22, 2018

Thank you @LarsMengel.

@ganez12

This comment has been minimized.

Copy link

ganez12 commented Jan 22, 2018

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

@ammard2u

This comment has been minimized.

Copy link

ammard2u commented Jan 22, 2018

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

@kkajdd

This comment has been minimized.

Copy link

kkajdd commented Jan 22, 2018

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

@LarsMengel

This comment has been minimized.

Copy link

LarsMengel commented Jan 22, 2018

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.

@kkajdd

This comment has been minimized.

Copy link

kkajdd commented Jan 22, 2018

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

@psmyrdek

This comment has been minimized.

Copy link

psmyrdek commented Jan 22, 2018

Solved by updating to 1.6.5

@jadeite100

This comment has been minimized.

Copy link

jadeite100 commented Jan 22, 2018

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?

@Dagonium

This comment has been minimized.

Copy link

Dagonium commented Jan 22, 2018

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!

31453 added a commit to aol/moloch that referenced this issue Jan 22, 2018

@lawmbass

This comment has been minimized.

Copy link

lawmbass commented Jan 22, 2018

Thanks @LarsMengel that solution worked out for me. 👍

@gerrymcdonnell

This comment has been minimized.

Copy link

gerrymcdonnell commented Jan 22, 2018

thanks @LarsMengel had same problem and that fixed it.

gerrymcdonnell added a commit to gerrymcdonnell/testrestapi that referenced this issue Jan 22, 2018

changed the cli after update module errors
Error: Cannot find module '@angular-devkit/core' - after clean install;

angular/angular-cli#9307
@tienthanhjlw

This comment has been minimized.

Copy link

tienthanhjlw commented Jan 22, 2018

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

@adil-boukdair

This comment has been minimized.

Copy link

adil-boukdair commented Jan 22, 2018

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

@raphaelbluteau

This comment has been minimized.

Copy link

raphaelbluteau commented Jan 23, 2018

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

@gerrymcdonnell

This comment has been minimized.

Copy link

gerrymcdonnell commented Jan 23, 2018

@tienthanhjlw yes that worked too!

@bobbypulpel

This comment has been minimized.

Copy link

bobbypulpel commented Jan 23, 2018

@tienthanhjlw Thanks, it worked for me!

@aman119

This comment has been minimized.

Copy link

aman119 commented Jan 23, 2018

Thank you @LarsMengel. It worked for me

frederikprijck added a commit to frederikprijck/microservice-angular-iframe that referenced this issue Apr 13, 2018

Update angular/cli dependency
Previously, `ng build` produced an error because of angular/angular-cli#9307

This commit updates the package.json dependency to install `@angular/cli` version 1.6.5, which resolves this issue.
@vieckys

This comment has been minimized.

Copy link

vieckys commented Apr 20, 2018

@LarsMengel Great. Did the trick. Thanks man

@nidhivc

This comment has been minimized.

Copy link

nidhivc commented Apr 24, 2018

fixed issue for me @pmesserschmidt

eugenioLopezRamos added a commit to continuum/storymapper that referenced this issue Apr 26, 2018

Fixes a bug that stopped the app from starting
- @angular/cli version had no caret at the beginning of the version
- See: angular/angular-cli#9307 (response by
LarsMengel)
@yuehernkang

This comment has been minimized.

Copy link

yuehernkang commented Apr 27, 2018

@tienthanhjlw thanks !

@DerejeKitaw

This comment has been minimized.

Copy link

DerejeKitaw commented May 4, 2018

@LarsMengel, Thanks

@rogerandreeta

This comment has been minimized.

Copy link

rogerandreeta commented May 5, 2018

Thank you, genius!

@natanaelfonseca

This comment has been minimized.

Copy link

natanaelfonseca commented May 5, 2018

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

@mikerames

This comment has been minimized.

Copy link

mikerames commented May 7, 2018

@LarsMengel thanks mate. worked great

@danger89

This comment has been minimized.

Copy link

danger89 commented May 12, 2018

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

@pedrodominguesp

This comment has been minimized.

Copy link

pedrodominguesp commented May 27, 2018

Thank you @LarsMengel

@NivethaH

This comment has been minimized.

Copy link

NivethaH commented Jun 6, 2018

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

@JohannesHoppe

This comment has been minimized.

Copy link
Contributor

JohannesHoppe commented Jun 10, 2018

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.

@niubenben

This comment has been minimized.

Copy link

niubenben commented Jun 28, 2018

npm i npm@latest -g

@simoutn

This comment has been minimized.

Copy link

simoutn commented Jul 18, 2018

Thanks a lot..! It worked..!!! npm install

@krishna-suman

This comment has been minimized.

Copy link

krishna-suman commented Jul 31, 2018

Thanks: LarsMengel. Your solution worked like a charm.

@FatemeFazli

This comment has been minimized.

Copy link

FatemeFazli commented Aug 7, 2018

i got this error when i wanted to use my global ng‍‍‍ and create new angular project,
this solved my problem:
sudo npm i -g @angular-devkit/core

@jbernard1

This comment has been minimized.

Copy link

jbernard1 commented Aug 8, 2018

@FatemeFazli Yeah that is exactly what I did, all the other solutions did not work for me.

@JeanLLopes

This comment has been minimized.

Copy link

JeanLLopes commented Aug 12, 2018

run npm install

@kcrossman

This comment has been minimized.

Copy link

kcrossman commented Aug 31, 2018

For Angular 6 you need to install/update @angular/cli, @angular-devkit/build-angular, @angular/compiler, and @angular/compiler-cli.

npm i --save-dev @angular/cli @angular-devkit/build-angular @angular/compiler @angular/compiler-cli

Running npm update after is probably another good idea.

@hewity

This comment has been minimized.

Copy link

hewity commented Sep 10, 2018

@LarsMengel Just run with the same issue, I followed your guide and edited from "1.7.4" to "^1.7.4" then updated. It worked 💯 Thank you for your great solution!

@Ivan1234

This comment has been minimized.

Copy link

Ivan1234 commented Oct 5, 2018

@LarsMengel thank you!

@bipon68

This comment has been minimized.

Copy link

bipon68 commented Oct 23, 2018

@tienthanhjlw Thank you. Now working.

kelsos added a commit to raiden-network/webui that referenced this issue Nov 27, 2018

Fix dependencies for angular/cli
Should fix #1196

As explained in the above issue we were getting:

```
Running ['/home/lefteris/.npm-global/bin/npm', 'run', 'build:prod'] in '/home/lefteris/ew/raiden/raiden/ui/web'

> raidenwebui@0.2.0 build:prod /home/lefteris/ew/raiden/raiden/ui/web
> ng build --prod --aot

module.js:487
    throw err;
    ^

Error: Cannot find module '@angular-devkit/core'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/lefteris/ew/raiden/raiden/ui/web/node_modules/@angular-devkit/schematics/src/tree/virtual.js:10:16)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! raidenwebui@0.2.0 build:prod: `ng build --prod --aot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the raidenwebui@0.2.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/lefteris/.npm/_logs/2018-01-24T11_36_30_610Z-debug.log
Traceback (most recent call last):
  File "setup.py", line 186, in <module>
    'raiden = raiden.__main__:main'
  File "/home/lefteris/.virtualenvs/raidenpy3/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 99, in run
    subprocess.check_call(command, cwd=cwd)
  File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/lefteris/.npm-global/bin/npm', 'run', 'build:prod']' returned non-zero exit status 1.
```

A lot of other projects had this problem and the solution explained in this post
works: angular/angular-cli#9307 (comment)

kelsos pushed a commit to kelsos/webui that referenced this issue Nov 29, 2018

Fix dependencies for angular/cli
Should fix #1196

As explained in the above issue we were getting:

```
Running ['/home/lefteris/.npm-global/bin/npm', 'run', 'build:prod'] in '/home/lefteris/ew/raiden/raiden/ui/web'

> raidenwebui@0.2.0 build:prod /home/lefteris/ew/raiden/raiden/ui/web
> ng build --prod --aot

module.js:487
    throw err;
    ^

Error: Cannot find module '@angular-devkit/core'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/lefteris/ew/raiden/raiden/ui/web/node_modules/@angular-devkit/schematics/src/tree/virtual.js:10:16)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! raidenwebui@0.2.0 build:prod: `ng build --prod --aot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the raidenwebui@0.2.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/lefteris/.npm/_logs/2018-01-24T11_36_30_610Z-debug.log
Traceback (most recent call last):
  File "setup.py", line 186, in <module>
    'raiden = raiden.__main__:main'
  File "/home/lefteris/.virtualenvs/raidenpy3/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 99, in run
    subprocess.check_call(command, cwd=cwd)
  File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/lefteris/.npm-global/bin/npm', 'run', 'build:prod']' returned non-zero exit status 1.
```

A lot of other projects had this problem and the solution explained in this post
works: angular/angular-cli#9307 (comment)
@Dipak84

This comment has been minimized.

Copy link

Dipak84 commented Jan 3, 2019

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

thankyou

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment