当我们点Debug Android时,会弹出以下错误
Could not debug. Unable to set up communication with VSCode react-native extension. Is this a react-native project, and have you made sure that the react-native npm package is installed at the root?

解决方法:当时我全局安装的react-native-cli版本为最新的2.0.0,可能是这个版本的Bug,需要回退到1.3.0或者更低版本。

npm -g uninstall react-native-cli
npm -g install react-native-cli@1.3.0
1
2
参考:https://github.com/Microsoft/vscode-react-native/issues/365

调试时不需要勾选ALL Exceptions,否则运行起来处处thow Error(),程序会运行不起来。

记录VSCode开发React Native的一些坑

 


出现以下红屏(Unable to connect with remote debugger):

记录VSCode开发React Native的一些坑

 


解决方法:摇下手机,在弹出的对话框中选择“Dev Settings”,再选择“Debug server host & port for device”,输入电脑的IP地址和监听端口号(默认为8081,用英文分号隔开),例如:192.168.2.32:8081

相关文章:

  • 2021-09-16
  • 2021-09-15
  • 2021-09-17
  • 2021-09-17
  • 2021-07-30
  • 2020-01-01
  • 2021-09-17
猜你喜欢
  • 2021-11-02
  • 2021-11-14
  • 2021-08-01
  • 2021-06-24
  • 2021-12-20
  • 2017-12-15
  • 2021-07-27
  • 2019-10-08
相关资源
相似解决方案