简体   繁体   English

WebStorm反应原生调试不起作用

[英]WebStorm react-native debug not working

I'm using WebStorm for developing a react-native app + an emulator from the Android Studio virtual device. 我正在使用WebStorm从Android Studio虚拟设备开发一个react-native app +一个模拟器。

The app is loaded great from the WebStorm into the emulator but the debugger isn't working, won't stop on breakpoints. 应用程序从WebStorm加载到模拟器,但调试器不工作,不会在断点上停止。

This is my settings: 这是我的设置:

  1. This is the configuration of WebStorm: 这是WebStorm的配置:

    运行/调试配置

  2. The device in the emulator is Nexus 5X API 22 (Android 5.1 x86), i enabled "Remote JS Debugging" after its first loaded. 模拟器中的设备是Nexus 5X API 22(Android 5.1 x86),我在首次加载后启用了“远程JS调试”。

  3. WebStorm output: WebStorm输出:

    /usr/local/bin/node --debug-brk=60746 --expose_debug_as=v8debug /Applications/WebStorm.app/Contents/plugins/JavaScriptDebugger/proxy/launcher.js --port=8081 --sourcesStoragePath=/dev/calculatorApp/.tmp/reactNativeBuild Debugger listening on [::]:60746 [intellij] Downloaded debuggerWorker.js (Logic to run the React Native app) from the Packager. / usr / local / bin / node --debug-brk = 60746 --expose_debug_as = v8debug /Applications/WebStorm.app/Contents/plugins/JavaScriptDebugger/proxy/launcher.js --port = 8081 --sourcesStoragePath = / dev / calculatorApp / .tmp / reactNativeBuild监听[::]的调试器:60746 [intellij]从Packager下载的debuggerWorker.js(运行React Native应用程序的逻辑)。

    [intellij] Starting debugger app worker. [intellij]启动调试器app worker。

    [intellij] Established a connection with the Proxy (Packager) to the React Native application [intellij]与React Native应用程序的Proxy(Packager)建立连接

    [intellij] Debugging session started successfully. [intellij]调试会话已成功启动。

    Running application "CalculatorApp" with appParams: {"initialProps":{},"rootTag":1}. 使用appParams运行应用程序“CalculatorApp”:{“initialProps”:{},“rootTag”:1}。 DEV === true, development-level warning are ON, performance optimizations are OFF DEV === true,开发级别警告为ON,性能优化为OFF

    Process finished with exit code 137 (interrupted by signal 9: SIGKILL) 进程以退出代码137结束(由信号9中断:SIGKILL)

In my case I found out that the debugger in IntelliJ/WebStorm wouldn't work if I create the project with create-react-native-app app-name from the command line. 在我的情况下,我发现如果我从命令行使用create-react-native-app app-name创建项目,IntelliJ / WebStorm中的调试器将无法工作。

However, the debugger does attach if you create the project following the prompts inside of IntelliJ/WebStorm itself. 但是,如果您按照IntelliJ / WebStorm本身的提示创建项目,则调试器附加。

eg File -> New -> Project -> React Native 例如文件 - >新建 - >项目 - >反应原生

I suspect it is because it doesn't use the create-react-native-app command to generate the project files but rather some other mechanism. 我怀疑这是因为它不使用create-react-native-app命令来生成项目文件,而是使用其他一些机制。

If I run create-react-native-app app-name and then load the project in IntelliJ/WebStorm, I noticed that the only sub-directories it creates are node-modules and .expo . 如果我运行create-react-native-app app-name ,然后在IntelliJ / WebStorm中加载项目,我注意到它创建的唯一子目录是node-modules.expo

However, if you create the React Native project in IntelliJ/WebStorm, it generates additional directories, android , ios , __tests__ , that are not created when you run create-react-native-app app-name . 但是,如果您在IntelliJ / WebStorm中创建React Native项目,它会生成其他目录, androidios__tests__ ,这些目录在运行create-react-native-app app-name时不会创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM