Connection to localhost port 8081 [tcp/sunproxyadmin] succeeded!
Port 8081 already in use, packager is either not running or not running correctly
Command /bin/sh failed with exit code 2
端口8081被占用。
$ Movies git:(master) lsof -i:8081
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 4848 luke 23u IPv6 0xdaf20bcf2310becd 0t0 TCP *:sunproxyadmin (LISTEN)
$ Movies git:(master) kill -9 4848
$ Movies git:(master) netstat -na | grep 8081
$ Movies git:(master)
還發(fā)現(xiàn)一種可以改變react native 監(jiān)聽端口的方法。
- cd project-dir && react-native start --port 8889;
- 到xcode里面search所有的8081,將它們替換為8889;
- xcode找到 Libiaries/React.xcodeproj/Build Phases/Run Scripts. 替換8081.
- run it.