I've found myself in an almost endless cycle of errors when trying to update my Angular CLI and NPM. Every time I update, I am met with WARN messages telling me to install peer dependencies (see below), but each time I install a dependency, I am met with more WARN messages. Is there a better way of handling this situation or does it seriously take hours?
npm WARN @angular/[email protected] requires a peer of @angular/[email protected]
but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of typescript@>=2.4.2
<2.6 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of
@angular/core@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of
@angular/common@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of
@angular/forms@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-
devkit/[email protected] but none is installed. You must install peer dependencies
yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-
devkit/[email protected] but none is installed. You must install peer
dependencies yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-
devkit/[email protected] but none is installed. You must install peer dependencies
yourself.
npm WARN [email protected] requires a peer of
@angular/core@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN [email protected] requires a peer of
@angular/common@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-
browser@^4.0.0 but none is installed. You must install peer dependencies
yourself.
npm WARN [email protected] requires a peer of
@angular/animations@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 3 but none
is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of popper.js@^1.12.3 but
none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^2.4.7 || ^4.0.0
but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^2.4.0 ||
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^2.4.0 ||
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.4.2 <2.6 but none
is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
[email protected]: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
I know I must be doing something wrong, but I'm new to Angular.
This question is related to
angular
dependencies
angular-cli
npm-install
NPM package libraries have a section in the package.json file named peerDependencies. For example; a library built in Angular 8, will usually list Angular 8 as a dependency. This is a true dependency for anyone running less than version 8. But for anyone running version 8, 9 or 10, it's questionable whether any concern should be pursued.
I have been safely ignoring these messages on Angular Updates, but then again we do have Unit and Cypress Tests!
I found that running the npm install
command in the same directory where your Angular project is, eliminates these warnings. I do not know the reason why.
Specifically, I was trying to use ng2-completer
$ npm install ng2-completer --save
npm WARN saveError ENOENT: no such file or directory, open 'C:\Work\foo\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Work\foo\package.json'
npm WARN [email protected] requires a peer of @angular/common@>= 6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@>= 6.0.0 but noneis installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/forms@>= 6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN foo No description
npm WARN foo No repository field.
npm WARN foo No README data
npm WARN foo No license field.
I was unable to compile. When I tried again, this time in my Angular project directory which was in foo/foo_app, it worked fine.
cd foo/foo_app
$ npm install ng2-completer --save
You can ignore the peer dependency warnings by using the --force flag with Angular cli when updating dependencies.
ng update @angular/cli @angular/core --force
For a full list of options, check the docs: https://angular.io/cli/update
Source: Stackoverflow.com