React native change listening port

前端 未结 13 1393
既然无缘
既然无缘 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

    The simplest solution is:

    The below command will build Android or iOS package which will listen to port 1234

    For iOS: react-native run-ios --port=1234

    For Android react-native run-android --port=1234

    If you are using metro-server then you can add port under server object like :

    server:{ port:1234 }

    or

    run

    react-native start --port=1234

    Find out more configuration for metro-server here: https://facebook.github.io/metro/docs/en/configuration

    But requires 0.55 and above.

提交回复
热议问题