react-native: React Native 0.43 upgrade error

Description

When my project upgrade to React Native 0.43,hint errors as follow:

├── UNMET PEER DEPENDENCY react@15.4.2
├── react-addons-pure-render-mixin@15.4.2
├── react-native@0.43.0
├── react-native-extended-stylesheet@0.3.2
└── react-native-scrollable-tab-view@0.6.0

npm ERR! peer dep missing: react@16.0.0-alpha.6, required by react-native@0.43.0
npm ERR! peer dep missing: react@^15.5.0, required by react-addons-shallow-compare@15.5.0-alpha.0

How to resolve it?

Reproduction Steps and Sample Code

I use npm install --save react-native@0.43 to upgrade React Native

Additional Information

  • React Native version: 0.43
  • Platform: Android
  • Development Operating System: MacOS
  • Dev tools: Android Studio 2.2.3

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 38 (5 by maintainers)

Most upvoted comments

Upgrading npm seems to fix the issue:

npm install npm@latest -g

I get UNMET PEER DEPENDENCY react@16.0.0-alpha.6 even though react@16.0.0-alpha.6 is installed.

when i exe npm install react-native@16.0.0-alpha.6 --save success.

Just delete package-lock.json solved the problem. Don’t worry, after you run npm install, package-lock.json will come back. I am not familiar with yarn, but I guess the file was generated by yarn to keep packages consistent.

@githubmss, I had the same error [Cannot find module ‘anymatch’] after upgrading from RN 0.41.2 to 0.44.1.

After re-installing NPM, NODE & REACT-NATIVE-CLI as per @petersuwara suggestion, I also had to delete ‘package-lock.json’ in the project directory in order to resolve. No idea why.

I’m having the same issue with react-native-maps@0.14.0 (latest)

react-native-maps@0.14.0 requires a peer of react@>=15.4.0 but none was installed.

react@16.0.0-alpha.6 installed

I’ve been getting the same issue as @githubmss after upgrading to NPM 5.0.2, but luckily, like @ahilton suggested, deleting package-lock.json and running npm install again solved it.

Did not work for me, even after upgrading npm. Previous versions of react-native seemed to work ok until 0.43. Here is the error:

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ‘:app’.

Could not resolve all dependencies for configuration ‘:app:_debugApkCopy’. Could not resolve com.facebook.fresco:fresco:1.0.1. Required by: testproj:app:unspecified > com.facebook.react:react-native:0.43.3 Could not resolve com.facebook.fresco:fresco:1.0.1. Could not get resource ‘https://jcenter.bintray.com/com/facebook/fresco/fresco/1.0.1/fresco-1.0.1.pom’. Could not GET ‘https://jcenter.bintray.com/com/facebook/fresco/fresco/1.0.1/fresco-1.0.1.pom’. jcenter.bintray.com Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.0.1. Required by: testproj:app:unspecified > com.facebook.react:react-native:0.43.3 Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.0.1. Could not get resource ‘https://jcenter.bintray.com/com/facebook/fresco/imagepipeline-okhttp3/1.0.1/imagepipeline-okhttp3-1.0.1.pom’. Could not GET ‘https://jcenter.bintray.com/com/facebook/fresco/imagepipeline-okhttp3/1.0.1/imagepipeline-okhttp3-1.0.1.pom’. jcenter.bintray.com

Update: I resolved this by adding a gradle.properties file to my .gradle folder with proxy variables in it (I am behind a proxy). The solution is specific for Android since react-native uses gradle for building the Android version. I am on windows, so my .gradle folder was C:\Users\my_user_id\.gradle. Here are the variables I set (replace my_proxy and port values with whatever is proper in your environment):

systemProp.http.proxyHost=my_proxy.com systemProp.http.proxyPort=80 systemProp.https.proxyHost=my_proxy.com systemProp.https.proxyPort=80

@liftyourgame his approach works for me too 😃 hooray

just i got a warning, not sure is there any side effect?

npm WARN react-test-renderer@15.4.2 requires a peer of react@^15.4.2 but none was installed.

hmm?