0

I'm new to react, and I'm having a lot of trouble getting started. Here's a list of errors I run into in sequence:

  1. Run npm install on a package, then react-native run-ios. Then error:

Command 'run-ios' unrecognized. Make sure that you have run 'npm install' and that you are inside a react-native project.

  1. Run install the latest react-native (according to this question), which solves the problem.

  2. Rerun the simulator. Error:

Cannot find entry file index.ios.js in any of the roots: ["/Users/Dan/ReactApp/node_modules/react-native/packager"

  1. Run kill -9 (process Id of server on 8081) && npm start (according to this question)

  2. Next error:

Cannot read property 'ReactCurrentOwner' of undefined.

  1. I remove node_module, run npm install, yarn add react-navigation (If I use npm to install this module, I'll go back to the first erorr again). according to this.

  2. Back to 1.

  3. I give up and manually copy over my code to a new project.

This is incredibly frustrating. What am I doing wrong?

System Info:

  • OS: OSX 10.12.6 Beta
  • Simulator: iOS 10.3
  • XCode: 8.3.3
  • Node: 7.4.0
  • Npm: 5.0.3
  • React: 15.5.4
  • React-Native: 0.45.0
  • React-Native-Cli: 2.0.1
dmr07
  • 1,388
  • 2
  • 18
  • 37
  • It seems to be a dependency issue. For some reason, my react version is set to 15.5.4 when it should be 16.0.0.alpha12. – dmr07 Jun 08 '17 at 03:09
  • This is a known issue with RN 0.45 - https://stackoverflow.com/questions/44413022/entry-point-for-packager/44415654#44415654 – G0dsquad Jun 08 '17 at 08:48

1 Answers1

0

Okay, so first, make sure you're in the correct directory. It sounds silly but it happens. You should be able to ls and see package.json.

If that's the case and it doesn't work, make sure you have react-native-cli installed globally. npm install -g react-native-cli You use which react-native to verify.

Next try killing the packager and xcode and restarting. Try running it again. If it doesn't work, kill xcode and the packager again, open the project with 'open ios/.xcodeproj', hit the run button and see if it works.

All in all I wouldn't reccomend using npm and yarn together. Stick with one or the other. I use npm.

The error Cannot find entry file index.ios.js in any of the roots: ["/Users/Dan/ReactApp/node_modules/react-native/packager"

Leads me to believe you're not in the correct directory.

klvs
  • 1,074
  • 6
  • 21
  • I'm fairly certain that I'm in the right directory as its one of the first things I've read, and that I've had to go through this process 5 times today. With regards to yarn and npm, one of the packages doesn't install properly with npm for some reason. I'll try sticking with yarn. – dmr07 Jun 08 '17 at 03:12
  • 1
    If you do `npm start -- --reset-cache` it will work, but you need to do this every time. See https://github.com/facebook/react-native/issues/14246. I assume RN will fix this next release as it's a pain. – G0dsquad Jun 08 '17 at 08:49