dev server returned error code 403 react native

前端 未结 6 1113
长情又很酷
长情又很酷 2020-12-07 01:24

Followed the steps here to try react-native android on a windows box.

  1. On a separate prompt I executed react-native start which is running fin
相关标签:
6条回答
  • 2020-12-07 01:57
    1. Press cmd + M (Ctrl + M for windows) to open your dev menu for the emulator (Please make sure your react-native app is open in the active window of the android emulator before using this command)
    2. Click Dev Settings
    3. Under Debugging select Debug server host & port for device
    4. Enter the correct url and port for your application in your case 10.0.2.2:8088

    Once you do that you can reload your application and it should work.

    0 讨论(0)
  • 2020-12-07 01:58

    This worked for me. Does the same thing but quick.

    Just set the port when run the app

    react-native run-android --port=8082

    0 讨论(0)
  • 2020-12-07 01:59

    1) First set the port number as 8088 in below file

    yourproject\node_modules\react-native\local-cli\server\server.js
    

    now build the project.

    2) Follow below steps updating Dev server path in emulator

    • Ctrl + M for windows to open your dev menu for the emulator.
    • Click Dev Settings
    • Under Debugging select Debug server host & port for device
    • Enter the url and port for your application as 10.0.2.2:8088
    0 讨论(0)
  • 2020-12-07 02:04

    A) Set the new port for dev server
    User command react-native start --port=8088
    or
    yourproject\node_modules\react-native\local-cli\server\server.js to set the the available port say 8080
    now use react-native start to start server on 8080

    B) Now to establish communication between emulator and dev server, use below command
    adb -s emulator -5554 reverse tcp:8088 tcp:8088
    i) 5554 =>emulator port (adb devices command will tell you emulator port but if this command is not working then set the path C:/../android-sdk/platform-tools in Path environemnt variable )
    ii) 8088 =>server port

    C) run the command react-native run-android

    D) Follow below steps updating Dev server path in emulator

    i) Ctrl + M for windows to open your dev menu for the emulator.
    ii) Click Dev Settings
    III) Under Debugging select Debug server host & port for device
    IV) Enter the url and port for your application as 10.0.2.2:8088

    0 讨论(0)
  • 2020-12-07 02:06

    This issue might occur because of the blockage of default port. In my case, I was able to fix it after executing following steps-

    1. Start dev server on a new port:- react-native start --port=8088
    2. Open developer menu by vibrating on actual connected device or pressing 'Ctrl + M' on emulator.
    3. Select Dev Settings
    4. Under Debugging select Debug server host & port for device
    5. Enter the url and port for your application as '10.0.2.2:8088'
    0 讨论(0)
  • 2020-12-07 02:11

    Just run this one your phone, it is a waste of time to try to figure out the hard coded React code for the emulator. It just does not seem like enough time was spent fixing this issue. Spent 3 days on reading way to many blogs, and trying way to many things and nothing worked. Our company also runs McAfee and I had the same issue.

    0 讨论(0)
提交回复
热议问题