angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.79k stars 11.98k forks source link

Angular CLI 1.6.x Peer Dependency Warning from npm #8767

Closed TheSamsterZA closed 6 years ago

TheSamsterZA commented 6 years ago

Versions

Angular CLI: 1.6.0
Node: 7.10.0
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

Repro steps

  1. ng new myapp --routing
  2. cd myapp
  3. npm list --depth=0

Observed behavior

Step 1 warns with:

npm WARN @schematics/angular@0.1.10 requires a peer of @angular-devkit/schematics@0.0.40 but none is installed.
You must install peer dependencies yourself.

Step 3 errors with:

+-- @angular/animations@5.1.0
+-- @angular/cli@1.6.0
+-- @angular/common@5.1.0
+-- @angular/compiler@5.1.0
+-- @angular/compiler-cli@5.1.0
+-- @angular/core@5.1.0
+-- @angular/forms@5.1.0
+-- @angular/http@5.1.0
+-- @angular/language-service@5.1.0
+-- @angular/platform-browser@5.1.0
+-- @angular/platform-browser-dynamic@5.1.0
+-- @angular/router@5.1.0
+-- @types/jasmine@2.5.54
+-- @types/jasminewd2@2.0.3
+-- @types/node@6.0.92
+-- codelyzer@4.0.1
+-- core-js@2.5.1
+-- jasmine-core@2.6.4
+-- jasmine-spec-reporter@4.1.1
+-- karma@1.7.1
+-- karma-chrome-launcher@2.1.1
+-- karma-cli@1.0.1
+-- karma-coverage-istanbul-reporter@1.3.0
+-- karma-jasmine@1.1.1
+-- karma-jasmine-html-reporter@0.2.2
+-- protractor@5.1.2
+-- rxjs@5.5.5
+-- ts-node@3.2.2
+-- tslint@5.7.0
+-- typescript@2.4.2
`-- zone.js@0.8.18

npm ERR! peer dep missing: @angular-devkit/schematics@0.0.40, required by @schematics/angular@0.1.10

Desired behavior

No peer dependency warnings/errors from npm by using the Angular CLI.

Mention any other details that might be useful (optional)

I get the same warning in step 1 from npm when I install the Angular CLI globally with:

npm i -g @angular/cli

This is detrimental to the first-run experience for new users. Sure, we could ignore the warning, but I'd much prefer it if installing and using the Angular CLI did not throw up things that might cause issues down the line.

mythz commented 6 years ago

This also causes global commands like npm ls -g to throw a "npm ERR! peer dep missing" error.

whyvrafvr commented 6 years ago

Same behaviour running npm update -g.

npm WARN @schematics/angular@0.1.10 requires a peer of @angular-devkit/schematics@0.0.40 but none is installed. You must install peer dependencies yourself. npm WARN @schematics/schematics@0.0.10 requires a peer of @angular-devkit/schematics@0.0.40 but none is installed. You must install peer dependencies yourself.

npm ERR! code E503 npm ERR! 503 All backends failed or unhealthy: @ngtools/webpack@https://registry.npmjs.org/@ngtools/webpack/-/webpack-1.9.0.tgz

ibqn commented 6 years ago

I am also effected by this when running sudo npm install -g @angular/cli

/usr/lib
└─┬ @angular/cli@1.6.0 
  ├─┬ @angular-devkit/build-optimizer@0.0.35 
  │ ├─┬ loader-utils@1.1.0 
  │ │ ├── big.js@3.2.0 
  │ │ └── emojis-list@2.1.0 
  │ ├── source-map@0.5.7 
  │ └── typescript@2.6.2 
  ├─┬ UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.41
  │ ├── @angular-devkit/core@0.0.22 
  │ ├── UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.40
  │ ├── @schematics/schematics@0.0.10 
  │ └── minimist@1.2.0 
deebloo commented 6 years ago

looks like schematics is set as a peerDependency. @clydin was there a reason not to just make it a devDependency?

ibqn commented 6 years ago

similar to issue #8787

moritz-h commented 6 years ago

@deebloo peerDepency is not the problem. I think the problem is by fixing a specific version. @angular/cli depends on "@angular-devkit/schematics": "~0.0.40" This will currently install 0.0.41. @schematics/angular and @schematics/schematics has set

"peerDependencies": {
  "@angular-devkit/schematics": "0.0.40"
},

They will not find 0.0.40 and should probably peer depend on the same version @angular/cli depends on.

GTrebaol commented 6 years ago

Is there any workaround for that issue? Installing the dependencies manually doesn't seems to work either.

moritz-h commented 6 years ago

@GTrebaol workaround is just ignore the warning :smile: I should run without problems with 0.0.41. Problem is just that this warning is a little bit annoying but it does not break anything.

deebloo commented 6 years ago

@moritz-h ohhhhhh. thanks makes sense!

Brocco commented 6 years ago

This has been addressed via #8785

moritz-h commented 6 years ago

@Brocco

8785 does change the minimum version within the @angular/cli dependencies. The warnings are created from the dependencies within @schematics/angular and @schematics/schematics

Will the changes from @angular/cli will be used within the @schematics packages? I saw the package.json here https://github.com/angular/devkit/blob/master/packages/schematics/angular/package.json with dependency version set to 0.0.0. Also saw the monorepo config: https://github.com/angular/devkit/blob/master/.monorepo.json and wondered where exactly the dependency versions are set.

titocr commented 6 years ago

@moritz-h As @mythz noted, this also causes 'npm ls' to throw an error. This caused our ci job to break, and we'll need to modify it now. Not the end of the world, but you seem to suggest it's a non-issue. It does take real-world dev time to track down the cause of these things.

moritz-h commented 6 years ago

@titocr I never suggested this is a non-issue. Is said the WORKAROUND is just ignore the warning. By not breaking I meant Angular(/CLI) works just fine when 0.0.41 is installed, even if npm complains about missing 0.0.40. (Actually I thought describing the workaround I found, could save others time by not need to investigate more details about where the warning comes from, while waiting for a fix. :smile: )

tfbkny commented 6 years ago

Noob question: @moritz-h Will a simple update be enough to remove the warning and prevent other things to break (as mentioned by @titocr ) or would one need to uninstall and reinstall? Thanks :)

mythz commented 6 years ago

@tfbkny it's still broken as there hasn't been an update after 1.6.0 with the fix yet. not sure when the next release is planned but it's annoying having 1.6.0 installed is still breaking scripts that run commands like npm ls.

titocr commented 6 years ago

@Brocco Can/should this issue be re-opened? It's something of a breaking change for some people, and I didn't see another open issue that would address it. (directed at you since you closed it)

Sangeethaself commented 6 years ago

I get the same warning issue when installing angular cli globally...

when will expect to fixed the issue with new release.. ???

Sangeethaself commented 6 years ago

I am new to angular ... I dont know what am doing wrong

when I install angular cli local folder not global am getting the following error ... please help me out from this

npm WARN angular-cli No description npm WARN angular-cli No repository field. npm WARN angular-cli No README data npm WARN angular-cli No license field. npm WARN @schematics/angular@0.1.10 requires a peer of @angular-devkit/schematics@0.0.40 but none is installed. You must install peer dependencies yourself.


I have one more question ... what is the difference of Global and Local install of Angular cli

I have searched about it .. I understand that if we go with global install of angular cli we get some issue in future.. in local we dont get any issues in future.. Please suggest me which way to go .... with reason.,...

Thanks in advance.

Danirv commented 6 years ago

Just do: npm i --save @angular-devkit/schematics@0.0.40

version 0.0.41 still show warning, but 0.0.40 resolve it

moritz-h commented 6 years ago

@Danirv Don't install 0.0.40. ng new is broken with 0.0.40, see this issue: https://github.com/angular/angular-cli/issues/8765 0.0.41 is a fix for that.

Danirv commented 6 years ago

@moritz-h ok, so install 0.0.41 and ignore warning. Thanks!

rrauenza commented 6 years ago

Here's a workaround since 0.0.41 is apparently only needed in ng new (?):

For starting an angular project, do this first:

npm i --save @angular-devkit/schematics@0.0.41

But once you have it new'ed, then just change the version back to 0.0.40 to make npm happy again:

npm i --save @angular-devkit/schematics@0.0.40
nabidul commented 6 years ago

I solved with:

npm install rxjs@5.5.5
npm i --save @angular-devkit/schematics@0.0.4
TheSamsterZA commented 6 years ago

@Brocco and @clydin Please provide a long-term solution, that does not require the workarounds provided here.

As I mentioned in my original comment, seeing peer dependency warnings really puts off newcomers (I have experienced this first-hand as a trainer).

On the up-side, I've been using Angular 5.1.0 and CLI 1.6.0 and the development experience has been quite pleasant. Thanks for all of your hard work! 😃

raechelann-zz commented 6 years ago

As a newcomer, I second the "puts off newcomers" comment. I have all the shiney and new node, cli etc and I still cant get things to run as all the "look how awesome angular is" demos say the examples should run. It's like returning to DLL hell. Why would I want to chase dependencies and versions?

weo3dev commented 6 years ago

@Sangeethaself - Hey, welcome to the world of Angular!

So for starters, the warnings you are seeing are simply that: warnings. However, a little explanation of what you are seeing would probably help you.

The first four warnings is merely Angular-CLI itself complaining gently that you left some blanks open, and it is politely suggesting you could fill those in.

The final warning is what this error thread is about, and what some are discussing how/what/where/when to fix it, as it seems to be detrimental to some basic npm commands that need to be used in real-world environments.

You need a start point that is not on an error thread such as this. Since I do not know your personal budget, here is a FREE link that was literally updated THIS MONTH, and will give you some understanding of what is going on inside your Angular build: https://www.udemy.com/angular-tutorial-for-beginners/

Disclaimer: I have not and do not work for Udemy, but they have been a great source of knowledge for me personally.

Good luck with your coding adventures!

AreJay-Smith commented 6 years ago

This is my first time working with CLI and I've been trying for hours to get this to work. I get these warnings every time I install cli using:

npm install -g @angular/cli

When I try

ng help

It tells me ng: command not found even though I installed it globally. Is it these dependencies that are preventing it from being installed globally or am I barking up the wrong tree?

RubixRevenge commented 6 years ago

@AreJay-Smith

When I try ng help

Try ng --help instead.

TheSamsterZA commented 6 years ago

Following up on this: installing @angular/cli@1.6.3 resolves this specific issue for me. However:

daviian commented 6 years ago

Still an issue with version 1.6.4. npm ERR! peer dep missing: @angular-devkit/schematics@0.0.43, required by @schematics/angular@0.1.12

Why is this issue still not reopened as it definitely is not solved!

whyvrafvr commented 6 years ago

Same for me :(. I guess it was solved, no?

filipesilva commented 6 years ago

I checked and @schematics/angular@0.1.12 requires exactly @angular-devkit/schematics@0.0.43, while we use a newer version on Angular CLI (0.0.45). This is a bug in our release scripts I believe.

ilhomelv commented 6 years ago

this sucks: can someone help in here: npm WARN @schematics/schematics@0.0.13 requires a peer of @angular-devkit/schematics@0.0.46 but none is installed. You must install peer dependencies yourself.

mkotsollaris commented 6 years ago

Having the same issue... Any solution for this?

MorganMarshall commented 6 years ago

I have also just received these warnings after updating to 1.6.4 via npm.

kinmanlam commented 6 years ago

I have confirmed @MorganMarshall findings. I tried to manually install the dependencies: npm install --save @angular-devkit/schematics@0.0.48

But received:

`-- @angular-devkit/schematics@0.0.48
  `-- UNMET PEER DEPENDENCY @angular-devkit/schematics@0.0.46

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN @schematics/schematics@0.0.13 requires a peer of @angular-devkit/schematics@0.0.46 but none was installed.

Trying to install 0.0.46 version:

npm install --save @angular-devkit/schematics@0.0.46

Results in:

npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\\package.json'
C:\Users\
`-- @angular-devkit/schematics@0.0.46

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\package.json'

NOTE: I was able to setup and run projects without a problem, given these are optional dependencies.

unit-cesar commented 6 years ago

image

guilima commented 6 years ago

same problem screenshot from 2018-01-17 12-05-45

FrankDupree commented 6 years ago

Having the same issue here. screenshot 9

slaatee commented 6 years ago

same for me

arnjmllr commented 6 years ago

I also am getting this error. :( I had latest version of node, downgraded to 6.90. same error over and over:

C:\code\udemy>ng new test 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. (C:\Users\arnjm\AppData\Roaming\npm\node_modules\@angular\cli\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)

fredgate commented 6 years ago

Same error when upgrading to ng cli from 1.6.3 to 1.6.4. And now ng build fails :-(

> ng build --prod

module.js:540
    throw err;
    ^

Error: Cannot find module '@angular-devkit/core'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Fred\Pimentour\spa\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\tree\virtual.js:10:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
ptmccarthy commented 6 years ago

I am also seeing this error today and is preventing any ng command from working:

npm install warnings:

npm WARN @angular-devkit/schematics@0.0.49 requires a peer of @angular-devkit/core@0.0.26 but none was installed.
npm WARN @schematics/angular@0.1.14 requires a peer of @angular-devkit/core@0.0.26 but none was installed.

error from any ng command:

> ng

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> (<...>/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)

Installed versions:

benc-uk commented 6 years ago

Fix seems to be running npm install @angular-devkit/schematics@0.0.45 --no-save Combined with this bug https://github.com/angular/angular/issues/21621 this has not been a good day for the Angular CLI :(

guilhermejcgois commented 6 years ago

In an interval of 2 hours since last build... SURPRISE!! 😢

fredgate commented 6 years ago

@benc-uk For me the problem was rather with @angular-devkit/core. Your solution to manually install this dependency can work on a local computer, but it is not sufficient for continuous integration server. For the moment, for me, the workaround was to install the package as dev dependency.

arnjmllr commented 6 years ago

Can you share the exact npm command(s) you used?

I haven’t been able to get a work around working.

Thanks

On Thu, Jan 18, 2018 at 1:51 PM Frédéric Barrière notifications@github.com wrote:

@benc-uk https://github.com/benc-uk For me the problem was rather with . Your solution to manually install this dependency can work on a local computer, but it is not sufficient for continuous integration server. For the moment, for me, the workaround was to install the package as dev dependency.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/8767#issuecomment-358793376, or mute the thread https://github.com/notifications/unsubscribe-auth/ALo3tmKrp6SeWFXlfYvWF_RPDyjTSkjuks5tL7zzgaJpZM4Q40Bx .

-- Thanks,

Aaron

fredgate commented 6 years ago

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

arnjmllr commented 6 years ago

Thanks! I just ran that update and it worked. I then updated to version to @angular-devkit/core@0.0.28

Now I'm on cli 1.6.4, node 8.9.4 angular 5.2.0. ng new, ng serve, ng test and ng e2e all seem to be working fine.

Thanks again

Aaron

On Thu, Jan 18, 2018 at 2:12 PM, Frédéric Barrière <notifications@github.com

wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/8767#issuecomment-358798945, or mute the thread https://github.com/notifications/unsubscribe-auth/ALo3tjfJW-nfAzS6_PPgwsPpfJgu13RYks5tL8HKgaJpZM4Q40Bx .

-- Thanks,

Aaron

unit-cesar commented 6 years ago

For me the 'update' didn't work, so I uninstalled and installed it with the version tag. See the step by step:

Check outdated packages: npm outdated -g --depth=0. image

Uninstall npm uninstall -g @angular-devkit/core

Clean npm cache verify; npm cache clean --force

Install with version tag npm install -g @angular-devkit/core@0.0.28 Or npm install -g @angular-devkit/core@latest