devkit icon indicating copy to clipboard operation
devkit copied to clipboard

bug(schematics): Cannot find module '@angular-devkit/core'

Open meDavid opened this issue 9 years ago • 44 comments

Bug Report or Feature Request (mark with an x)

- [X ] bug report -> please search issues before submitting
- [ ] feature request

Area

- [ ] devkit
- [X ] schematics

Versions

node 6.9.1 npm 5.4.2 Windows 10

Repro steps

If you globally install @angular-devkit/schematics and try to create a new schematic using schematics @schematics/schematics:schematic --name=SomeSchematicName you will get the following error:

The log given by the failure

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:\......\node_modules\@schematics\schematics\schematic\factory.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)

Desired functionality

No errors and a generated new schematics blueprint

Mention any other details that might be useful

the @schematics/schematics:schematic factory uses a dependency on @angular-devkit/core, but this dependency is not in the package.json

meDavid avatar Nov 03 '17 10:11 meDavid

Yea same issue here, after uninstalling angular-cli then after installing the latest angular-cli, ng help boom this

theoomoregbee avatar Jan 18 '18 20:01 theoomoregbee

npm install -g @angular-devkit/core fixed it anyway related to this angular/angular-cli#9190

theoomoregbee avatar Jan 18 '18 20:01 theoomoregbee

@theo4u
So should I just add it to my package.json if angular-cli uses it internally? Because we don't use this module in our code base.

rathodmitesh916 avatar Jan 18 '18 20:01 rathodmitesh916

@jainmitesh09 Oh can't really say, since it's in the pkgjson . https://github.com/angular/angular-cli/blob/9c871b003a8d91051e9d7affc63206aef4b71e20/package.json#L45

But i added it to mine to stop the error when running local commands like ng serve --> npm install @angular-devkit/core --save-dev

theoomoregbee avatar Jan 18 '18 20:01 theoomoregbee

Same here. As a quick fix npm i -D @angular-devkit/core in the project folder fixed it for me.

szkrd avatar Jan 18 '18 21:01 szkrd

I rolled back to angular-cli 1.6.3

germs12 avatar Jan 18 '18 21:01 germs12

It seems that some dependencies became peerDependencies. :(

But restarting from scratch now works because of newer version just deployed

mmercure avatar Jan 18 '18 21:01 mmercure

Taking @germs12 advice, I rolled back to 1.6.3. But then I re-installed 1.6.4 and everything seems to be working again.

ankemp avatar Jan 18 '18 22:01 ankemp

I don't know what happened, I got the same error during npm install ~1 hour ago, but now everything worked fine again (without any change from my side meantime).

merobal avatar Jan 18 '18 22:01 merobal

There was indeed a bad release about 1h ago but we've since rolled back and republished the previous version while we work on a real fix.

filipesilva avatar Jan 18 '18 22:01 filipesilva

See angular/angular-cli#9276

hansl avatar Jan 18 '18 22:01 hansl

@hansl This ticket was about schematics, not the devkit / cli

meDavid avatar Jan 18 '18 22:01 meDavid

Sorry, i just wanted to add the following as context:

We just released an emergency patch for the devkit and are working to release a patch for 1.4 and 1.5 that will fix this retroactively. After this we will re-release the CLI and the devkit.

hansl avatar Jan 18 '18 22:01 hansl

I've cleared everything out and reinstalled. So far nothing is working. I have a feeling it's due to some cached version of the CLI on my computer.

Amusing part of this for me is this: I was researching the problem for an issue in AWS CodeBuild. Fixed that, but now I can't get ng to work on my local machine!

Thanks @hansl for you and your teams work.

germs12 avatar Jan 19 '18 00:01 germs12

I should have checked this a minute ago before upgrading. :(

Does anyone know what is the latest working version?

After upgrading, I got the error for missing devkit. Installed it. And now I have this error.

screenshot 2018-01-18 16 38 32

nnennajohn avatar Jan 19 '18 00:01 nnennajohn

@germs12 just run this command in your prompt ""npm install -g @angular-devkit/core"" i think it will fix your problem

KWFE avatar Jan 19 '18 00:01 KWFE

@germs12 Uninstalling latest and install

npm install -g @angular/[email protected] @angular-devkit/core

worked for me. At least until a fix to current bug.

nnennajohn avatar Jan 19 '18 01:01 nnennajohn

@nnennajohn : Did not worked for me...

For me

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

did the trick.

ediri avatar Jan 19 '18 06:01 ediri

For me this is like the fifth time during the past 3 months that the community around npm & angular managed to somehow break the fundamental rule of any sane package repository: the published versions never ever change. If I have a package.json with only fixed versions and I don't modify the code, then my builds should work every single day. How am I supposed to deliver a software package, if I cannot guarantee it will even build on a random day?

MateuszStefek avatar Jan 19 '18 10:01 MateuszStefek

@nnennajohn Not working for me npm install @angular-devkit/core

reachbikramsingh avatar Jan 19 '18 11:01 reachbikramsingh