热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用WebStorm设置远程节点调试的问题-IssuessettingupremotenodedebuggingwithWebStorm

Ivestartedmyapplicationonmyserverwithpm2:我用pm2在我的服务器上启动了我的应用程序:pm2startpathlibstart

I've started my application on my server with pm2:

我用pm2在我的服务器上启动了我的应用程序:

pm2 start /path/lib/start-server.js --name="cdl-debug" -- --inspect

Which would be equivalent to node /path/lib/start-server.js --inspect

这相当于节点/path/lib/start-server.js --inspect

The application starts and runs, although I see no notice in the logs about any debugging like explained here

应用程序启动并运行,虽然我在日志中没有注意到任何调试,如此处所述

I've opened up port 9229 in the firewall and setup my WebStorm debug config with Attach to Node.js/Chrome like so:

我在防火墙中打开了端口9229并使用Attach to Node.js / Chrome设置了我的WebStorm调试配置,如下所示:

enter image description here

Then when I run the debugger it tries to connect for a while and finally fails with the message: Connection timed out. No further information.

然后,当我运行调试器时,它尝试连接一段时间,最后失败并显示消息:Connection timed out。没有更多信息。

Is there something else I should do? The WebStorm documentation doesn't mention much about the required setup on the server.

还有什么我应该做的吗? WebStorm文档没有提到服务器上所需的设置。

1 个解决方案

#1


2  

When running node /path/lib/start-server.js --inspect, you are passing --inspect to your application, not to Node.js. As a result, debugger is not started. You need to make sure to pass --inspect-brk to Node.js in order to debug your app:

运行节点/path/lib/start-server.js --inspect时,您将--inspect传递给您的应用程序,而不是Node.js.因此,调试程序未启动。您需要确保将--inspect-brk传递给Node.js以调试您的应用:

node --inspect-brk /path/lib/start-server.js

node --inspect-brk /path/lib/start-server.js

You can specify --inspect-brk in your pm2 process.json, like

您可以在pm2 process.json中指定--inspect-brk,就像

"node_args": [
      "--inspect-brk=7000"
    ]

and then start your app with pm2 start process.json

然后使用pm2 start process.json启动你的应用程序


推荐阅读
author-avatar
lily--妹妹
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有