react@15.2.1包不满足其兄弟姐妹的peerDependencies要求

时间:2016-07-13 11:56:32

标签: javascript reactjs npm

尝试npm install时,我收到了这些错误。 如果我使用的是最新版本的React,那么无法解释为什么它没有运行。

npm ERR! peerinvalid The package react@15.2.1 does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer react-addons-css-transition-group@15.2.1 wants react@^15.2.1 npm ERR! peerinvalid Peer react-animate-on-change@0.2.0 wants react@^0.14.5 npm ERR! peerinvalid Peer react-dom@15.2.1 wants react@^15.2.1 npm ERR! peerinvalid Peer react-dropdown@1.0.4 wants react@^0.14.7 || ^15.0.0-0 npm ERR! peerinvalid Peer react-masonry-component@4.2.0 wants react@^0.14.0 || ^15.0.0-0 npm ERR! peerinvalid Peer react-modal@1.4.0 wants react@^0.14.0 || ^15.0.0-0 npm ERR! peerinvalid Peer react-native@0.29.0 wants react@~15.2.0 npm ERR! peerinvalid Peer react-redux@4.4.5 wants react@^0.14.0 || ^15.0.0-0 npm ERR! peerinvalid Peer react-router@2.5.2 wants react@^0.14.0 || ^15.0.0 npm ERR! peerinvalid Peer react-toastr@2.7.0 wants react@^0.14.0 || ^15.0.0 npm ERR! peerinvalid Peer redux-devtools@3.3.1 wants react@^0.14.0 || ^15.0.0-rc.1

2 个答案:

答案 0 :(得分:7)

您还可以将npm更新为版本3.新版本将确保您没有此问题。

答案 1 :(得分:3)

那是因为你项目中的其他软件包需要较低版本的React,比如15.0,而不是15.2。您可以在此处https://nodejs.org/en/blog/npm/peer-dependencies/#the-solution-peer-dependencies和此处https://docs.npmjs.com/files/package.json#peerdependencies

详细了解peerDependencies

解决您的问题,在更新其他库之前不要升级您的React版本。