如何远程调试Typescript node.js程序

问题描述 投票:0回答:1

通过这种设置,我可以远程调试js文件(在我的Raspberry Pi上)。但是我想打破ts文件,正如我在本地调试时能做的那样。这可能吗?

我在launch.json尝试了不同的参数,但没有运气。 sourceMaps和outFiles似乎没有任何效果。

launch.json

{
        "type": "node",
        "request": "attach",
        "name": "Attach to Remote",
        "address": "192.168.0.222",
        "port": 9229,
        "protocol": "inspector",
        "localRoot": "${workspaceFolder}/src",
        "remoteRoot": "/home/pi/BADGER/src",
        "outFiles": [
            "${workspaceFolder}/bin/**/*.js"
        ],
        "sourceMaps": true
}
node.js typescript visual-studio-code
1个回答
0
投票

基于这篇文章:Debugging TypeScript in VS Code without compiling, using ts-node

再次 - 鉴于您的节点应用程序在http://192.168.0.222:9229上运行(尝试手动输入此路径以验证)

将其添加到launch.json

    {
        "name": "Attach",
        "type": "node",
        "request": "attach",
        "port": 9229,
        "address": "192.168.0.222",
        "restart": true,
        "sourceMaps": true,
        "outDir": "${workspaceRoot}",
        "localRoot": "${workspaceRoot}",
        "remoteRoot": "/home/pi/BADGER/src"
    }
© www.soinside.com 2019 - 2024. All rights reserved.