react-native: [0.45.0] Project roots are incorrect if packager starts when invoking `react-native run-ios`

Steps for reproduction

First make sure you have no react-native packager instance running

react-native init Bananas
cd Bananas
react-native run-ios

Effect

I get the error

Cannot find entry file index.ios.js in any of the roots: ["/Users/dshe/code/Bananas/node_modules/react-native/packager"]

image

Workaround

Start the packager from yarn start

About this issue

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

Commits related to this issue

Most upvoted comments

In my case:

Open terminal Tab 01: react-native start Open terminal Tab 02: react-native run-ios

Should work :-p

+1

@kostap13 Hmm. Here is what I did to resolve the error:

  1. Do not close the terminal window of the server that threw the error.
  2. lsof -n -i4TCP:8081
  3. kill -9 (process id returned above)
  4. npm start

I used this solution and succeed twice (one for upgrading from 0.44 to 0.45, one for downgrading from 0.46 to 0.45)

@MSchmidt @ds300 Like I said

but react-native run-ios works for me after i cleaned up everything through the commands I listed above

Let me rephrase the solution again:

  1. open you simulator, delete the app
  2. watchman watch-del-all
  3. rm -rf node_modules && npm install
  4. npm start -- --reset-cache
  5. STOP you packager that started by last command
  6. react-native run-ios

I got this when doing react-native run-android as well (this is with a brand new project created with react-native init TestProject3), so I don’t think the problem is limited to ios.

image