【问题标题】:WebStorm debug breakpoints not working for Node.js projectWebStorm 调试断点不适用于 Node.js 项目
【发布时间】:2021-04-14 02:01:47
【问题描述】:

我正在尝试在作为 React Native 前端应用程序的 Node 项目中设置调试断点。

我正在使用 WebStorm v2020.3 和 Node v15.14.0

我对项目的 Node.js 运行配置的设置:

我在整个项目中设置了断点,但没有一个被触发。

我的调试设置“附加到 Node.js/Chrome”运行配置:

首先,我运行项目并得到这个输出:

/usr/local/bin/node --inspect-brk /Users/lachlangrant/Git/RN-BILLI-APP/node_modules/react-native/cli.js start
Debugger listening on ws://127.0.0.1:9229/051a5d86-ad54-4a6c-bbaa-366bbe8a938e
For help, see: https://nodejs.org/en/docs/inspector

接下来,我运行调试器并获得以下输出:

Debugger attached.
                                                          
               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               
                                                          
(node:33264) Warning: Accessing non-existent property 'splice' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
                 Welcome to React Native!
                Learn once, write anywhere



To reload the app press "r"
To open developer menu press "d"

然后我在 Xcode 中使用模拟器触发断点,没有任何反应。

我查看了各种主题,包括this one

有什么想法吗?提前致谢。

【问题讨论】:

    标签: node.js react-native webstorm jetbrains-ide


    【解决方案1】:

    您要调试什么 - react-native/cli.js 脚本或您的 React Native 应用程序?在后一种情况下,请使用React Native 运行配置。见https://www.jetbrains.com/help/webstorm/2021.1/react-native.html#ws_react_native_debug

    【讨论】:

    • 我正在尝试调试我的 React Native 应用程序,但目前的指令是运行 react-native/cli.js - 这实际上是让应用程序在我的机器上运行的原因。我也使用过npx react-native run-iosnpx react-native run-android。我不确定主项目到底是哪个文件,根目录中有一个index.js 和一个node.js。如果事情不清楚,请道歉(这是我从某人那里继承的项目,文档基本上不存在)。
    • 按照上述说明工作,谢谢。
    猜你喜欢
    • 2022-11-04
    • 2016-01-25
    • 1970-01-01
    • 2018-11-24
    • 1970-01-01
    • 1970-01-01
    • 2018-04-29
    • 2018-08-11
    • 1970-01-01
    相关资源
    最近更新 更多