React native change listening port

前端 未结 13 1383
既然无缘
既然无缘 2020-12-05 17:36

I am using react native android and having face issues to deploy the app on an android device. When I run

react-native start, it won\'t start dev server

13条回答
  •  悲&欢浪女
    2020-12-05 18:07

    Not sure if this is documented or not[1], you can specify the port via a CLI argument, like this:

    react-native start --port 9988
    

    I found it in the source code, and it worked on my local machine :)

    https://github.com/facebook/react-native/blob/master/local-cli/server/server.js#L30


    [1] This is now documented here: https://facebook.github.io/react-native/docs/troubleshooting#using-a-port-other-than-8081

提交回复
热议问题