美文网首页
react-native example error

react-native example error

作者: 朝圣的路上 | 来源:发表于2016-05-12 14:53 被阅读572次

    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 监听端口的方法。

    1. cd project-dir && react-native start --port 8889;
    2. 到xcode里面search所有的8081,将它们替换为8889;
    3. xcode找到 Libiaries/React.xcodeproj/Build Phases/Run Scripts. 替换8081.
    4. run it.

    相关文章

      网友评论

          本文标题:react-native example error

          本文链接:https://www.haomeiwen.com/subject/oykprttx.html