使用 Expo 的错误 WebSocket connection to 'ws://localhost:19002/debugger-proxy?role=debugger&name=Chrome' failed: Error during WebSocket handshake: Unexpected response code: 400


Expo 调试

前提是在使用以下环境

名称 版本 icon
React native debugger V0.10
React devTools latest
Expo ~37.0.3 => 37.0.8

错误:


WebSocket connection to 'ws://localhost:19002/debugger-proxy?role=debugger&name=Chrome' failed: Error during WebSocket handshake: Unexpected response code: 400

接照本次的错误,是因为React native debugger无法成功访问ws://localhost:19002。

而很多开发将它定义为 WebSocket 的问题或是代理的问题。

答案连接了错误的端口导致。(但是如果并非这个问题,解决方案建议 expo diagnostics 诊断环境并重新安装来测试错误的重现。 )

下面我简单的描述端口的使用。

首先,运行 yarn start :

  • Metro Bundler on port 19001 —— 绑定React native debugger 的端口

  • Expo DevTools is running at http://localhost:19002 —— 浏览器 可视化DevTools

  • exp://127.0.0.1:19000 in iOS simulator —— 虚拟器使用的端口

有些问题可能很小,但它就是欺负末懂者,它会纠缠很久。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM