JS server not recognized, continuing with build

后端 未结 5 931
你的背包
你的背包 2021-02-14 13:35

Environment

Windows 10

Npm 5.5.1

react-native-cli 2.0.1

react-native 0.50.3

Genymotion Google Nexus 7 - 6.0.0 API 23

相关标签:
5条回答
  • 2021-02-14 13:59

    Just changing port doesnt solve the issue, instead it creates more unless you also change the port from the device itself.

    First, confirm if its the case:

    $> netstat -aon|findstr “8081”
    

    Now change it to run from a new Default Port

    a) Change env variable on windows to set a new port for RN:

    $> SET RCT_METRO_PORT=8083
    

    This is used in RN to use as the default port, and if not set it defaults to 8081

    b) Remove old reverse:

    $> adb reverse –remove-all
    

    c) Set new reverse port for the adb device:

    $> adb reverse tcp:8083 tcp:8083
    

    d) Change Dev Settings on the device from the default 8081 to 8083.

    Run the app and then run input keyevent 82, now select Dev Settings > Debug Server host … > enter new url: localhost:8083

    build and run again

    0 讨论(0)
  • 2021-02-14 13:59

    Try to turn off a local server program like MAMP, WAMP, OpenServer e.t.c. They can use the 8081 port.

    0 讨论(0)
  • 2021-02-14 14:09

    In my case (had the same error) I simply checked netstat in win CMD (check for reference). My problem was running another instance on port :8081 so I had to kill the bastard.

    1. Close all running local server instances.
    2. Check link for reference on killing :8081 proccess on Windows
    3. Rebuild & rerun project.
    4. Profit
    0 讨论(0)
  • 2021-02-14 14:09

    I had this issue when I had another process running on port 8081.

    1. Find the process lsof -i tcp:8081
    2. Get the PID, in my case 25120
    3. Kill the process: kill -9 25120
    4. Start React Native Again
    0 讨论(0)
  • 2021-02-14 14:10

    Steps that helped me in similar case:

    1. Running packager on port different than 8081: react-native start --port 8082 --reset-cache
    2. Running command react-native run-android --port 8082 in second Command Prompt window.
    3. After error screen appear clicking Ctrl + M.
    4. Clicking Dev Settings button at the bottom.
    5. Clicking Debug server host & port for device button.
    6. Writing localhost:8082 and clicking OK button.
    7. Again running command react-native run-android --port 8082
    0 讨论(0)
提交回复
热议问题