4
votes

Yes i have read this but still don't know how to make it work. react native - Port 8081 already in use, packager is either not running or not running correctly Command /bin/sh failed with exit code 2

Originally i was doing this

1. react-native init Hello
2. react-native run-ios

Then hit this "port 8081 already in use".

Did read the react doc, https://facebook.github.io/react-native/docs/troubleshooting.html

1. cannot kill the process using 8081, it keeps on coming back,
   and i don't want to kill it
2. react-native start --port=8088
3. update node_modules/react-
native/React/React.xcodeproj/project.pbxproj file. Did it.

Where and which step should i run "react-native start --port=8088" ?

btw, i'm an average engineer, but if i cannot run the very 1st react-native sample in 2 hours, i just cannot see how it can fly, this is very annoying.

2

2 Answers

8
votes

In RN 0.55 you can fix this with:

react-native start --port=1234

and then in a different window:

react-native run-ios --port 1234

Versions:

✗ react-native --version
react-native-cli: 2.0.1
react-native: 0.55.4
0
votes

In yarn managed project in package.json

 "scripts": {
      ...
    "ios": "npx react-native run-ios --port 19001 && npx react-native start --port 19001",
    "android": "npx react-native run-android --port 19001 && npx react-native start --port 19001",
    }