react-native: Ambiguous resolution of react-native

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v: 2.0.1
  2. node -v: v8.4.0
  3. npm -v: 5.3.0
  4. yarn --version:

Then, specify:

  • Target Platform: Android
  • Development Operating System: Windows 10 Home
  • Build tools: Android Studio

Steps to Reproduce

(Write your steps here:)

  1. Rename node_modules directory to node_modules_.
  2. Delete android directory.
  3. Execute npm i
  4. Execute react-native upgrade
  5. Execute react-native run-android

After not working I even deleted the node_modules_ directory. But the problem still persists.

Expected Behavior

It should just work as expected, run the app in the Android emulator.

Actual Behavior

It’s not working. React packager is complaining.

Reproducible Demo

https://github.com/ManvendraSK/ChatNowReactNativeSampleApp

packager command emulator

About this issue

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

Most upvoted comments

Also, delete system32

I’m having the same problem. It’s pointing to package.json files in directories that no longer exists. Have tried npm cache clean yarn cache clean etc… Keeps trying to resolve the react_native module to the non-existent dirs.

Any idea when this will be solved? For now I cannot install any pods that install React as well.

Reboot mac works

i tried to install, npm install --save react-native-router-flux@3.38.0 npm install -g react-native-git-upgrade react-native-git-upgrade

fixed thanks folks

@ManvendraSK try watchman watch-del-all Unfortunately, it did not help me 😞

Generally this issue arises when there are two folders of react-native. More often, if you use Pods, you have dependency that relies on the ‘React’ pod and thus you should reference the pod in your node_modules/ not install anothe react-native from cocopods. To do so, you can add the following to your Podfile

  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'React', :path => '../node_modules/react-native'

For me the error appeared in calling my Project ReactNative! As soon as I changed the name to something different than ./ReactNative the error disappeared!

Hey @jonathanoron and @radko93, it’s working fine!

npm start -- --reset-cache does work! But, after it has executed we need to kill this command and start with the usual one react-native run-android. watchman didn’t work though!

Thanks, guys. You both are Batman for me!

@jonathanoron I’ll try when back at home, right now in office 😉.

Let’s see what is next, I’ll keep you posted here. May be somebody would help like Batman! 😛