3

I'm creating a react native app using create-react-native-app

npm create-react-native-app 

I updated react-native version to 0.44.0, which requires to update react version to 16.0.0-alpha.6 This is my package.json

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "0.0.29",
    "jest-expo": "^0.4.0",
    "react-test-renderer": "~15.5.4"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/ex-navigation": "^2.11.1",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "expo": "^16.0.0",
    "react": "~16.0.0-alpha.6",
    "react-native": "0.44.0"
  }
}

Running npm install gives me following errors

C:\dev\repo\test>npm install
npm WARN lottie-react-native@1.1.1 requires a peer of react@>=15.3.1 but none was installed.
npm WARN react-native-maps@0.12.2 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-native-svg@4.4.1 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-static-container@1.0.1 requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.

It looks like react version 16.0.0-alpha.6 is not recognized by lottie-react-native, react-native-maps, react-native-svg, and react-static-container. I'm not sure if major version (15) must be met, or the alpha version 16 is not picked up by those libraries, or something else. Does anyone know how to fix this? Thanks.

hixhix
  • 771
  • 7
  • 23
  • Hi hixhix, your right. Problem here is dependency conflicts. Maps, svg, container and lottie versions all depend on peer of react@15 while you have updated to react native 0.44 which depends on peer of react@16. Your solution is to either upgrade all the libs to newer versions and check if they have updated their dependencies or downgrade to react@15. For me having ^ in dependencies always creates these conflicts, as it means auto update lib to newer version when available. Hopefully it will help. – Rishabh Bhatia May 11 '17 at 17:51

2 Answers2

0

I have a similar problem, actually right now I get this problem, whenever I try to create a new application with create-react-native-app. The only solution (hack) I have found right now is:

  1. Delete node_modules (for me it's not enough to just do npm install)
  2. Do npm install
Plaul
  • 7,191
  • 5
  • 19
  • 22
0

I just solve the same issue by removing the react-native folder in node_modules and reinstall the react-native by run this command

  1. Delete the react-native folder in node_modules
  2. Reinstall react-native by run npm install react-native

I think is more simply than deleting the entire node_modules as only the react-native packages and its package.json is missing.

Jokanola
  • 66
  • 5