适当的机制降级反应原生 [英] Proper mechanism to downgrade react-native

查看:65
本文介绍了适当的机制降级反应原生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况是这样的:

我有一份运作良好的反应原生项目的工作副本。如果它提交到我的git存储库。

I had a working copy of a react-native project that was working well. Had it commited to my git repository.

我决定将react-native升级到0.26.3然后再升级到0.28,最终导致了一个很大的依赖混乱。因此决定回到以前的工作版本。恢复了变化。从我的工作目录中删除了node_modules文件夹。

I decided to upgrade react-native to 0.26.3 and then 0.28 and finally ended up in a big dependency mess with collisions. So decided to go back to previous working version. Reverted the changes. Removed node_modules folder from my working directory.

但现在 npm install 就行不通了。

我在package.json中工作的依赖项

My working dependencies in package.json

  "dependencies": {
    "immutable": "^3.8.1",
    "key-mirror": "^1.0.1",
    "react": "^15.0.2",
    "react-native": "^0.26.0",
    "react-native-router-flux": "^3.26.1",
    "react-redux": "^4.4.5",
    "redux": "^3.5.2",
    "redux-thunk": "^2.1.0",
    "strformat": "0.0.7"
  },
  "devDependencies": {
    "babel-core": "^6.10.4",
    "babel-jest": "^12.1.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-react-native": "^1.9.0",
    "babel-register": "^6.9.0",
    "chai": "^3.5.0",
    "fetch-mock": "^4.5.4",
    "jest-cli": "^12.1.1",
    "mocha": "^2.5.3",
    "mockery": "^1.7.0",
    "nock": "^8.0.0",
    "redux-mock-store": "^1.1.1",
    "sinon": "^1.17.4",
    "sinon-chai": "^2.8.0",
    "sinon-stub-promise": "^2.0.0"
  }

现在我

npm ERR! peerinvalid The package react@15.1.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-native@0.26.3 wants react@15.0.2
npm ERR! peerinvalid Peer react-redux@4.4.5 wants react@^0.14.0 || ^15.0.0-0

这对我来说没有意义,因为我的反应依赖是15.0。 2,并且您可以在package.json中看到react-native 0.26.0。

This just not makes sense to me, as my react dependency is 15.0.2 and react-native 0.26.0 as you can see in package.json.

请注意,这是来自之前正在运行的提交(整个批次)。
我还做了 npm ls 。奇怪的错误依赖项在树中显示为错误版本的 react-native react-native-router-flux 做出反应

Note that this is from a previous commit that was working (the whole lot). I also did a npm ls. Weirdly wrong dependencies are shown in the tree like wrong versions of react-native, react-native-router-flux, react.

链接到ls输出

推荐答案

请更新你的<在package.json中code> react 依赖显式为 15.0.2 ,而不是 ^ 15.0.2 因为后者解析为 15.1.0 导致此问题。建议保留这种方式,直到下次升级并再次出现此错误(以避免反应同时更改其版本和 react-native 还没准备好。)

Please update your react dependency in package.json to explicitly be 15.0.2, not ^15.0.2 since the latter resolves to 15.1.0 which causes this issue. It is recommended to leave it that way until you upgrade for the next time and get this error once again (to avoid react changing its version in the meantime and react-native not being ready for it).

另外,使用npm3 EPEERINVALID 不再是错误,而是警告。

Also, with npm3 EPEERINVALID is no longer an error, but warning.

这篇关于适当的机制降级反应原生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆