【发布时间】:2017-03-20 19:19:27
【问题描述】:
我在理解如何为满足其对等(react-native 和 react-redux)依赖项的 react 的有效版本进行 sepcify 时遇到问题。这是我的package.json:
...
"dependencies": {
"react": "^15.3.2",
"react-native": "0.35.0"
"react-redux": "4.4.5",
"redux": "3.6.0",
}
此项目的初始开发工作(约 2 个月前)在 npm install 期间没有任何问题,但将此 repo 克隆到新环境并运行 npm install 会产生以下问题:
npm WARN peerDependencies The peer dependency react@~15.3.1 included from react-native 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! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package react@15.4.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-native@0.35.0 wants react@~15.3.1
npm ERR! peerinvalid Peer react-redux@4.4.5 wants react@^0.14.0 || ^15.0.0-0
似乎正在尝试安装 react@15.4.2,这是截至 2017 年 3 月 20 日的最新版本,据我了解 ^ semver 规范是正确的。
我尝试指定版本15.3.1、15.3.2、^15.3.1、^15.3.2、~15.3.1 等,但无论我输入什么,问题仍然存在。
还查看了https://github.com/facebook/react-native/blob/0.35-stable/package.json上的文件:
"peerDependencies": {
"react": "~15.3.1"
},
在https://github.com/reactjs/react-redux/blob/4.x/package.json:
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0 || ^15.4.0-0",
"redux": "^2.0.0 || ^3.0.0"
},
我对 package.json 这样的文件比较陌生,希望这是一个简单的解决方案,但我尝试过的一切都是空的。
【问题讨论】:
-
哦,另外,也许考虑更新你的 node 和 npm 版本,这些都比较旧了。
标签: reactjs npm react-native react-redux npm-install