Unable to connect with remote debugger

后端 未结 14 1271
予麋鹿
予麋鹿 2020-11-28 18:29

I\'m using React.JS and when I do react-native run-android (with my device plugged in) I see a blank page. When I shake the device and select Debug JS Rem

14条回答
  •  爱一瞬间的悲伤
    2020-11-28 18:57

    I had a similar issue that led me to this question. In my browser debugger I was getting this error message:

    Access to fetch at 'http://localhost:8081/index.delta?platform=android&dev=true&minify=false' from origin 'http://127.0.0.1:8081' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

    It took me awhile to realize I was using 127.0.0.1:8081 instead of localhost:8081 for my debugger.

    To fix it, I simply had to change Chrome from:

    http://127.0.0.1:8081/debugger-ui/
    

    to

    http://localhost:8081/debugger-ui/
    

提交回复
热议问题