5

I'm trying to install react-router but I get the following error.

$ npm install react-router
npm WARN peerDependencies The peer dependency [email protected] included from react-router will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "react-router"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0-rc1
npm ERR! peerinvalid Peer [email protected] wants [email protected]
npm ERR! peerinvalid Peer [email protected] wants react@>=0.13

npm ERR! Please include the following file with any support request:
npm ERR!     C:\ReactApps\good start\npm-debug.log

The package.json for react in node-modules shows that I use:

"version": "0.14.0-rc1",

Should I install an earlier version? It seems that 0.13.x might be a better supported version?

If that is the case, how can I install without messing up my current project?


After using

npm install npm -g

I typed npm -v and saw that the version in my project is still 2.11.13. I figured that it might be a local version of NPM so I typed:

npm install npm

hoping to get the latest version updated locally, but still got 2.11.13 when I checked for the version.

comp-asus XXX64 /c/ReactApps/goodRouter/goodrouter (master)
$ npm -v
2.11.3

comp-asus XXX64 /c/ReactApps/goodRouter/goodrouter (master)
$ npm install react-router
npm WARN peerDependencies The peer dependency [email protected] included from react-router will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "react-router"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants [email protected]

npm ERR! Please include the following file with any support request:
npm ERR!     C:\ReactApps\goodRouter\goodrouter\npm-debug.log

When checking globally I can see that it is updated:

$ npm list -g --depth=0
C:\Users\Roger\AppData\Roaming\npm

    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected] invalid
    ├── [email protected]
    └── [email protected]

But how do I use the global version in the project?

So the problem persists but I do believe you put me on the right track.


$ where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\Roger\AppData\Roaming\npm\npm
C:\Users\Roger\AppData\Roaming\npm\npm.cmd

So I should delete one of these?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
RogerDore
  • 93
  • 1
  • 7

1 Answers1

18

This is one of the major issues solved in npm@3. See https://github.com/npm/npm/issues/6565 for details.

Updating npm is the right thing to do:

$ npm install npm -g
eush77
  • 3,870
  • 1
  • 23
  • 30
  • Thank you! Please see update if you can. I do not have enough rep to +1 but I do thank you. – RogerDore Oct 07 '15 at 10:46
  • @RogerDore Are you using some tool for managing Node versions, like `nvm`? – eush77 Oct 07 '15 at 10:52
  • I am not familiar with Tools for managing Node versions. I will look up nvm right now. – RogerDore Oct 07 '15 at 10:58
  • @RogerDore No, I didn't mean that… There is another `npm` in your `$PATH` and `nvm` can be a source of this so I asked. You need to disable the other `npm` (move it or make it non-executable). – eush77 Oct 07 '15 at 11:05
  • @RogerDore Can you find that location with `where npm` or other suggestions from http://stackoverflow.com/questions/304319/? – eush77 Oct 07 '15 at 11:08
  • Ok! Im not sure of wath I am doing now but it seems that there are two: Made a new update. – RogerDore Oct 07 '15 at 11:13
  • @RogerDore So as it seems you are using `[email protected]` from `C:\Program Files\nodejs` but your global install directory is `C:\Users\Roger\AppData\Roaming\npm`. That is why you can't update `npm` easily. Moving or renaming `C:\Program Files\nodejs\npm` (and probably `npm.cmd`, I'm not sure) should fix the problem. – eush77 Oct 07 '15 at 11:23
  • By changing name as you suggested it now uses 3.3.5. Thank you! – RogerDore Oct 07 '15 at 11:31