For example, when I install Angular2:
npm install --save angular2
[email protected] /Users/doug/Projects/dougludlow/temp
+-- [email protected]
+-- UNMET PEER DEPENDENCY es6-promise@^3.0.2
+-- UNMET PEER DEPENDENCY es6-shim@^0.33.3
+-- UNMET PEER DEPENDENCY [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
npm WARN [email protected] requires a peer of es6-promise@^3.0.2 but none was installed.
npm WARN [email protected] requires a peer of es6-shim@^0.33.3 but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.
Is there a magic flag that I can pass to npm that will install the peer dependencies as well? I haven't been able to find one... It's tedious to manually copy and paste the peer dependencies and make sure I have the correct versions.
In other words, I'd rather not have to do:
npm install --save [email protected] es6-promise@^3.0.2 es6-shim@^0.33.3 [email protected] [email protected] [email protected]
What is the better way?
Execute this: npm install-test
I solved it by rewriting package.json
with the exact values warnings were about.
Warnings when running npm
:
npm WARN [email protected] requires a peer of es6-shim@^0.33.3 but none was installed.
npm WARN [email protected] requires a peer of [email protected]
In package.json
, write
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
Then, delete node_modules
directory.
Finally, run the command below:
npm install
Install yarn an then run
yarn global add install-peerdeps
The project npm-install-peers
will detect peers and install them.
As of v1.0.1
it doesn't support writing back to the package.json
automatically, which would essentially solve our need here.
Please add your support to issue in flight: https://github.com/spatie/npm-install-peers/issues/4
I experienced these errors when I was developing an npm package that had peerDependencies
. I had to ensure that any peerDependencies
were also listed as devDependencies
. The project would not automatically use the globally installed packages.
Cheat code helpful in this scenario and some others...
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected] >
+-- UNMET PEER DEPENDENCY
+-- UNMET PEER DEPENDENCY
)npm install
--save
npm install @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] --save
Source: Stackoverflow.com