23

I am getting this error when I run npm install. This seems because I am unable to satisfy some peer dependency but I am unsure which peer dependency I need to fix.

λ npm install

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react@15.3.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer belle@2.0.7 wants react@>=0.14.0 || ^15.0.0-rc
npm ERR! peerinvalid Peer material-ui@0.15.4 wants react@^15.0.0
npm ERR! peerinvalid Peer react-infinite@0.9.2 wants react@^15.0.0
npm ERR! peerinvalid Peer react-input-field@1.2.4 wants react@>=0.12.0
npm ERR! peerinvalid Peer react-router@0.13.6 wants react@0.13.x || 0.14.x || ^15.0.1
npm ERR! peerinvalid Peer react-tap-event-plugin@0.2.2 wants react@^0.14.0
npm ERR! peerinvalid Peer react-toolbox@1.2.1 wants react@~0.14 || ~15.3.0
npm ERR! peerinvalid Peer react-addons-css-transition-group@15.3.2 wants react@^15.3.2
npm ERR! peerinvalid Peer react-dom@15.3.2 wants react@^15.3.2

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Daljeet\Documents\hive\client\npm-debug.log

I have also attached a copy of the package.json

dependencies: 

  "dependencies": {
    "belle": "^2.0.7",
    "body-parser": "^1.6.5",
    "bootstrap": "^3.3.0",
    "compression": "^1.0.11",
    "config": "^1.21.0",
    "config-js": "^1.1.9",
    "connect-ensure-login": "^0.1.1",
    "cors": "^2.4.1",
    "dateformat": "^1.0.12",
    "dotenv": "^0.4.0",
    "errorhandler": "^1.1.1",
    "express": "^4.8.5",
    "express-jwt": "^0.3.1",
    "flux": "^2.0.1",
    "i": "^0.3.5",
    "immutability-helper": "^2.0.0",
    "jsonwebtoken": "^5.0.1",
    "jwt-decode": "^1.1.0",
    "keymirror": "^0.1.1",
    "lodash": "4.0.0",
    "log4js": "^0.6.38",
    "material-ui": "~0.15.4",
    "mongoose": "^4.3.4",
    "morgan": "^1.2.3",
    "normalize.css": "^4.2.0",
    "pg": "^4.5.5",
    "react": "15.3.2",
    "react-infinite": "^0.9.2",
    "react-input-field": "^1.2.4",
    "react-mixin": "^1.1.0",
    "react-router": "^0.13.2",
    "react-star-rating": "^1.4.2",
    "react-tap-event-plugin": "~0.2.2",
    "react-toolbox": "^1.2.1",
    "react-virtual-list": "^1.8.0",
    "reqwest": "2.0.5",
    "when": "^3.7.2"
  },
  "devDependencies": {
    "babelify": "^6.1.0",
    "browser-sync": "^2.1.6",
    "browserify": "^8.0.3",
    "clean-css": "^3.1.9",
    "eslint": "^0.14.1",
    "nodemon": "^1.5.0",
    "rework": "^1.0.1",
    "rework-npm": "^1.0.0",
    "rework-npm-cli": "^0.1.1",
    "serve": "^1.4.0",
    "uglify-js": "^2.4.15",
    "watchify": "^2.1.1"
  }
}
Daljeet Virdi
  • 601
  • 1
  • 6
  • 10
  • I am having this same problem. In a more condensed form: I'm being told v15.3.2 does not satisfy peer dependency ^0.14.8 || ^15.0.1 —— which is just wrong, it does satisfy that semver range. – davidtheclark Oct 01 '16 at 13:59
  • Could you cut all the npm warnings from your first code block? Those are kind of irrelevant: the errors are the issue. – davidtheclark Oct 01 '16 at 14:02
  • i thought the warnings may provide insight into dealing with the errors. – Daljeet Virdi Oct 01 '16 at 17:06
  • it worked when i updated npm `"npm install npm -g"` and then downgraded react to; `"react": "15.3.0"`, cleared cache: `npm cache clear`, removed node_modules, `rm -rf node_modules`, and reinstalled, `npm install`. – Daljeet Virdi Oct 01 '16 at 17:42
  • just by updating npm `npm install npm -g` can solve the problem. – Santosh Dangare Dec 15 '20 at 15:28
  • `npm i --force` worked for me – Teshie Ethiopia Feb 14 '22 at 20:18
  • Does this answer your question? [Unable to resolve dependency tree error when installing npm packages](https://stackoverflow.com/questions/64573177/unable-to-resolve-dependency-tree-error-when-installing-npm-packages) – Liam Nov 11 '22 at 08:40

6 Answers6

34

For me npm install --legacy-peer-deps worked. Please read about this flag before using it.

--legacy-peer-deps: ignore all peerDependencies when installing (in the style of npm version 4 through version 6).

Nikhil Gangai
  • 125
  • 3
  • 7
ChaitanyaBhatt
  • 1,158
  • 14
  • 11
30

it worked when I:


  1. updated npm "npm install npm -g"
  2. downgraded react to; "react": "15.3.0"
  3. cleared cache: npm cache clear
  4. removed node_modules, rm -rf node_modules,
  5. reinstalled node_modules, npm install.
Daljeet Virdi
  • 601
  • 1
  • 6
  • 10
7

Just update node package manager (npm) to the latest version.

npm install npm -g
Angel Garcia
  • 75
  • 1
  • 4
  • This worked for by peer dependencies warnings but any explanation on why it worked? – Ryan Jun 30 '22 at 07:54
  • Probably because in the earlier version of npm, they did not resolve peer dependencies. https://stackoverflow.com/questions/36781031/webpack-error-in-cannot-find-module-less – Achintha Isuru Oct 19 '22 at 07:05
1

I was facing the same issue and I used following things:

  1. Update the react version: "react": ^16.2.0" in package.json file
  2. Delete the node modules by rm -rf node_modules
  3. Run npm install
  4. npm update

This worked for me.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
0

Use the following command to resolve this when installing the node module

npm install --legacy-peer-deps

if above doesn't work for you then you can tey npm install --force

--legacy-peer-deps: ignore all peerDependencies when installing, in the style of npm version 4 through version 6.

0

I had similar issues until I

removed node_modules, rm -rf node_modules,
Made changes to package.json,
cleared cache: npm cache clear --force,
reinstalled node_modules, npm install.
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 23 '23 at 20:25