首页 文章

Webstorm node.js远程调试不会跳转到断点

提问于
浏览
1

我正在使用angular-fullstack生成器和Webstorm 10 .

node.js远程调试配置:

localhost: 127.0.0.1
 port: 5858

当我输入'grunt serve:debug'时:

Debugger listening on port 5858
Node Inspector v0.9.2
Visit http://localhost:8080/debug?port=5858 to start debugging.
Express server listening on 9000, in development mode

此时localhost:8080 / debug?port = 5858打开,然后启动我的node.js远程调试器 . 它说:

Connected to localhost:5858

但是,框架窗格完全空白,并且忽略所有断点 .

1 回答

  • 1

    那里有多个问题,与WebStorm,Grunt,Node本身有关......一般来说,为了能够调试angular-fullstack应用程序的服务器端代码,我建议如下:

    使用Node.js运行配置进行调试:

    Working directory: your project root folder
     JavaScript file: path/to/node_modules/grunt-cli/bin/grunt
     Application parameters: serve
    

    将以下行添加到Gruntfile.js的顶部;

    process.execArgv = [];
    

    这应解决调试Grunt子进程的问题 - 默认情况下,生成的子进程使用与父进程相同的调试端口 - 因此分叉进程被挂起并且应用程序'停止' . 另外,打开node_modules \ grunt-express-server \ tasks \ lib \ server.js并将第71行更改为:

    options.opts.unshift('--debug-brk');
    

    当使用--debug选项而不是--debug-brk生成子进程时,WebStorm调试器并不总是有时间在进程启动时注册断点,因此不会触发子进程中的断点 .

    为使用generator-angular-fullstack@2.0.13生成的应用程序编写说明;你可能有不同的设置......

相关问题