反应路由器 peerDependencies 错误
react-router peerDependencies error
我正在尝试安装 react-router,但出现以下错误。
$ npm install react-router
npm WARN peerDependencies The peer dependency react@0.13.x 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 react-addons-test-utils@0.14.0-rc1 wants react@^0.14.0-rc1
npm ERR! peerinvalid Peer react-router@0.13.4 wants react@0.13.x
npm ERR! peerinvalid Peer react-bootstrap@0.25.2 wants react@>=0.13
npm ERR! Please include the following file with any support request:
npm ERR! C:\ReactApps\good start\npm-debug.log
node-modules
中react
的package.json表明我使用:
"version": "0.14.0-rc1",
我应该安装早期版本吗?似乎 0.13.x 可能是一个更好的支持版本?
如果是这样,我怎样才能安装而不弄乱我当前的项目?
使用后
npm install npm -g
我输入了npm -v
,看到我项目里的版本还是2.11.13。
我认为它可能是 NPM 的本地版本,所以我输入:
npm install npm
希望能在本地更新到最新的版本,查版本的时候还是2.11.13。
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 react@0.13.x 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 react-router@0.13.4 wants react@0.13.x
npm ERR! Please include the following file with any support request:
npm ERR! C:\ReactApps\goodRouter\goodrouter\npm-debug.log
在全局检查时我可以看到它已更新:
$ npm list -g --depth=0
C:\Users\Roger\AppData\Roaming\npm
├── babel-eslint@4.1.3
├── bower@1.5.2
├── eslint@1.5.1
├── findup-sync@0.2.1
├── generator-angular@0.12.1
├── generator-karma@1.0.0
├── generator-meanjs@0.1.12
├── generator-polymer@1.1.0
├── generator-react-boilerplate@0.1.9
├── generator-react-webpack@1.2.12
├── grunt-cli@0.1.13
├── gulp@3.9.0
├── httpster@1.0.1
├── jspm@0.16.10
├── jsxhint@0.15.1
├── live-server@0.8.1
├── mean-cli@0.10.14
├── mocha@2.2.5
├── node-gyp@2.0.2
├── npm@3.3.5
├── react-tools@0.13.3
├── superstatic@2.2.1
├── tsd@0.6.4
├── typescript@1.7.0-dev.20150921 invalid
├── webpack@1.12.2
└── yo@1.4.7
但是如何在项目中使用全局版本呢?
所以问题仍然存在,但我相信你让我走上了正确的轨道。
$ 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
所以我应该删除其中一个?
这是 npm@3
中解决的主要问题之一。有关详细信息,请参阅 https://github.com/npm/npm/issues/6565。
更新 npm
是正确的做法:
$ npm install npm -g
我正在尝试安装 react-router,但出现以下错误。
$ npm install react-router
npm WARN peerDependencies The peer dependency react@0.13.x 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 react-addons-test-utils@0.14.0-rc1 wants react@^0.14.0-rc1
npm ERR! peerinvalid Peer react-router@0.13.4 wants react@0.13.x
npm ERR! peerinvalid Peer react-bootstrap@0.25.2 wants react@>=0.13
npm ERR! Please include the following file with any support request:
npm ERR! C:\ReactApps\good start\npm-debug.log
node-modules
中react
的package.json表明我使用:
"version": "0.14.0-rc1",
我应该安装早期版本吗?似乎 0.13.x 可能是一个更好的支持版本?
如果是这样,我怎样才能安装而不弄乱我当前的项目?
使用后
npm install npm -g
我输入了npm -v
,看到我项目里的版本还是2.11.13。
我认为它可能是 NPM 的本地版本,所以我输入:
npm install npm
希望能在本地更新到最新的版本,查版本的时候还是2.11.13。
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 react@0.13.x 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 react-router@0.13.4 wants react@0.13.x
npm ERR! Please include the following file with any support request:
npm ERR! C:\ReactApps\goodRouter\goodrouter\npm-debug.log
在全局检查时我可以看到它已更新:
$ npm list -g --depth=0
C:\Users\Roger\AppData\Roaming\npm
├── babel-eslint@4.1.3
├── bower@1.5.2
├── eslint@1.5.1
├── findup-sync@0.2.1
├── generator-angular@0.12.1
├── generator-karma@1.0.0
├── generator-meanjs@0.1.12
├── generator-polymer@1.1.0
├── generator-react-boilerplate@0.1.9
├── generator-react-webpack@1.2.12
├── grunt-cli@0.1.13
├── gulp@3.9.0
├── httpster@1.0.1
├── jspm@0.16.10
├── jsxhint@0.15.1
├── live-server@0.8.1
├── mean-cli@0.10.14
├── mocha@2.2.5
├── node-gyp@2.0.2
├── npm@3.3.5
├── react-tools@0.13.3
├── superstatic@2.2.1
├── tsd@0.6.4
├── typescript@1.7.0-dev.20150921 invalid
├── webpack@1.12.2
└── yo@1.4.7
但是如何在项目中使用全局版本呢?
所以问题仍然存在,但我相信你让我走上了正确的轨道。
$ 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
所以我应该删除其中一个?
这是 npm@3
中解决的主要问题之一。有关详细信息,请参阅 https://github.com/npm/npm/issues/6565。
更新 npm
是正确的做法:
$ npm install npm -g