react-native: Unable to resolve module react-native

We use GitHub Issues for bugs.

Description

I recently created a new project using react-native init MyProject. The app ran fine initially.

However now, when I run react-native run-ios or try to use xcode to run the app. I get the following error screen.

screen shot 2016-12-01 at 6 44 02 pm

I have followed the suggested instructions and have ran the following

rm -rf node_modules
rm -rf $TMPDIR/react-* --reset-cache
rm -rf node_modules/react-native/packager/packager.sh --reset-cache
npm cache clean
npm i

But I still experience the same problem

I have verified that react-native is in fact installed at the correct location.

  • React Native version: 0.38.0
  • Platform: iOS
  • Operating System: MacOS

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 10
  • Comments: 26 (1 by maintainers)

Most upvoted comments

+1 - i’ve gutted 2 projects now because of this, yikes

I resolved this using the react-native-git-upgrade package instead of react-native upgrade to upgrade the project. And because of this I had to use yarn instead of npm.

So, i did something like that:

npm i -g react-native-git-upgrade

git clone https://github.com/ifalldev/repo
cd repo

yarn
yarn add react@16.0.0-alpha.6
yarn add react-native@0.43.3
react-native-git-upgrade

rnpm link

react-native run-ios

Actually found something. I was getting the same error and just now after my first comment I checked if I had yarn installed and which version. After hitting yarn -v it installed itself and all of the dependancies that were removed during my npm install --save firebase. After the install, in another terminal instance I re-ran npm run start which didn’t have any issues then in the main terminal instance I ran react-native run-ios and that totally ran smoothly. When the problem (which this thread is about) was happening I couldn’t run react-native run-ios because it didn’t even recognize the root folder as a react-native file. Now it does. So give it a try. It doesn’t seem like a quick fix, it seems stable now. Saying that we’ll see how it goes… keeping a watchful eye.

+1

Using RN v44.2 and this is happening to me, the workaround isn’t working either.

After upgrading to react native 0.45.1 i have same issue. What i did:

  1. npm install --save react-native@0.45.1
  2. react-native upgrade
  3. react-native link
  4. remove node_modules
  5. Clear cache

Result - Unable to find module React Native

I just ran into this in a brand new project. Definitely not stale and none of the suggested actions change anything.

I resolved this with this comment after trying every solution under the sun.

  1. delete ios/ or android/
  2. react-native eject <-- this was what did it for me
  3. react-native-git-upgrade
  4. react-native link
  5. react-native run-ios