WebStorm Node.js TypeScript Express debug stuck on connecting to localhost
我正在尝试使用WebStorm调试TypeScript Express应用程序。
我在
1 2 3 4 | "scripts": { ... "debug":"node --inspect-brk=9229 --require ts-node/register -r tsconfig-paths/register server.ts" } |
我在命令行中运行
1 2 | Debugger listening on ws://127.0.0.1:9229/<somerandomid> For help see https://nodejs.org/en/docs/inspector |
现在,我可以通过进入Chrome浏览器从Chrome检查器进行调试,键入
问题是,使用WebStorm时无法调试。
我尝试了以下WebStorm调试配置:
1 2 3 4 | Attach to Node.js/Chrome Host: localhost Port: 9229 Attach to: Chrome or Node.js > 6.3 started with --inspect |
但是当我在WebStorm中进行调试时,调试器会继续说
我尝试禁用防火墙,但仍然无法正常工作。使用
我在做什么错,如何使用我的node.js Express TypeScript配置让WebStorm调试到断点?
使用您的方式启动应用程序/附加调试器,对我来说效果很好。 您使用什么WebStorm版本?
这是另外两种调试应用的方法:
- 使用Node.js运行配置(创建类似的配置并按Debug):
-
使用NPM运行配置:
-
将脚本更改为
"debug":"node %NODE_DEBUG_OPTION% --require ts-node/register -r tsconfig-paths/register server.ts" (如果在Linux / Mac OSX上,请将%NODE_DEBUG_OPTION% 替换为$NODE_DEBUG_OPTION -
单击装订线中的箭头,选择"调试"