简体   繁体   English

ts-node中的断点问题

[英]Issues with breakpoints in ts-node

I faced a very strange problem. 我面临一个非常奇怪的问题。 I have two working PC and one of them stop breaking on the breakpoints in one day. 我有两台正常工作的PC,其中一台可以在一天之内停止在断点处中断。 Another PC works properly the same as before. 另一台PC可以正常工作。 I tried to reinstall Node JS , ts-node and then even hard reset for windows (I use Windows) but without any success. 我尝试重新安装Node JSts-node ,然后甚至硬重置Windows(我使用Windows),但没有成功。
Then I thought that probably issue in my project and I tried to clone hello world project from google tutorial and I found that I still can't debug with it! 然后我认为这可能是我项目中的问题,我尝试从Google教程中克隆hello world项目,但发现我仍然无法对其进行调试!
So I successfully run an app on my port but breakpoint won't hit. 因此,我在端口上成功运行了一个应用程序,但断点不会出现。 This stop working in VS Code, in WebStorm and even Chrome debugger. 这将停止在VS Code,WebStorm甚至Chrome调试器中运行。

This is how I run an app: "C:\\Program Files\\nodejs\\node.exe" --inspect --require ts-node/register C:\\Projects\\node-typescript-starter-master\\src\\index.ts 这是我运行应用程序的方式: "C:\\Program Files\\nodejs\\node.exe" --inspect --require ts-node/register C:\\Projects\\node-typescript-starter-master\\src\\index.ts

Then I opened dev tools from chrome and I see this: 然后我从chrome中打开了开发工具,然后看到了:

在此处输入图片说明

Then I pressed "inspect" and I see message in console: Debugger attached. Debugger listening on ws://127.0.0.1:9229/8bae9408-867c-4278-9148-b6c90b35a8ae For help, see: https://nodejs.org/en/docs/inspector Debugger attached. 然后我按“检查”,然后在控制台中看到消息: Debugger attached. Debugger listening on ws://127.0.0.1:9229/8bae9408-867c-4278-9148-b6c90b35a8ae For help, see: https://nodejs.org/en/docs/inspector Debugger attached. Debugger attached. Debugger listening on ws://127.0.0.1:9229/8bae9408-867c-4278-9148-b6c90b35a8ae For help, see: https://nodejs.org/en/docs/inspector Debugger attached.

This is the next window. 这是下一个窗口。 Seems like I missing any files overhere. 好像我在这里丢失任何文件。

在此处输入图片说明

Does this mean that something is wrong with my file mapping ? 这是否意味着我的文件映射有问题? Please, let me any suggestion what can be a problem. 请让我提出任何建议,这可能是个问题。

Well, one of workaround is to don't use ts-node and just use default node js debugger config from WebStorm with adding TypeScript prelaunch compilation script. 好吧,一种解决方法是不使用ts-node,而仅使用WebStorm中的默认node js调试器配置并添加TypeScript预启动编译脚本。

Here is a screenshot how to configure: 这是如何配置的屏幕截图: 在此处输入图片说明

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

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