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)
还发现一种可以改变react native 监听端口的方法。
- cd project-dir && react-native start --port 8889;
- 到xcode里面search所有的8081,将它们替换为8889;
- xcode找到 Libiaries/React.xcodeproj/Build Phases/Run Scripts. 替换8081.
- run it.
网友评论