简体   繁体   中英

Version conflict of packages with react, react-native, react-dom, react-test-renderer

I am using the latest stable versions of react, react-native, react-test-renderer, react-dom.

Yet react-native has dependencies on react@16.0.0-alpha.12 ;

If I use this version (16.x) of react, then react-dom misbehaves saying it needs react 15.6.1

I am aware of this solution travis cannot build because Error: Cannot find module 'react-test-renderer/shallow' [the 2nd answer] but it doesn't account for react-native.

Any suggestions of an optimum version match for all given packages? here's my package.json

{
  "name": "exampleApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "15.6.1",
    "react-dom": "15.6.1",
    "react-native": "0.45.1",
    "react-test-renderer": "15.6.1"
  },
  "devDependencies": {
    "babel-jest": "20.0.3",
    "babel-preset-react-native": "2.0.0",
    "jest": "20.0.4"
  },
  "jest": {
    "preset": "react-native"
  }
}

React-Dom and React follow the same versioning scheme, so it makes sense that react-dom wants to use the same major version of react. Try upgrading both packages to 16.x!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM