【问题标题】:Node Debugging in WSLWSL 中的节点调试
【发布时间】:2021-06-18 03:46:39
【问题描述】:

我在 VSCode 中使用 Windows 10 WSL。

我有扩展远程开发,WSL,我也安装了节点,nvm。

在远程 WSL 中工作并尝试调试时,我根本没有节点选项。

当我运行文件时,我得到:

No debugger available, can not send 'variables'

我的launch.json如下:

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${file}"
        }
    ]
}```

Can someone please help me fix it by adding Node.js option so I can properly debug?

Thanks a lot in advance!

【问题讨论】:

    标签: node.js debugging visual-studio-code windows-subsystem-for-linux


    【解决方案1】:

    你最终找到解决方案了吗?

    我添加了类似的问题,我只能通过明确指定节点二进制路径来让事情正常工作。

    1. 通过发出以下命令获取您的节点二进制路径:
      which node

    2. 然后将其添加到您的 launch.json 配置中:

      {
          "name": "Launch Program",
          "program": "${workspaceFolder}/helloworld.js",
          "request": "launch",
          "skipFiles": [
              "<node_internals>/**"
          ],
          "type": "pwa-node",
          "runtimeExecutable": "/home/user01/.nvm/versions/node/v14.18.0/bin/node"
      },
      

    即使我只是简单的设置教程,仍然有问题发生:

    https://docs.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl

    【讨论】:

      猜你喜欢
      • 2019-02-11
      • 2021-11-27
      • 2020-12-14
      • 2022-10-06
      • 2019-03-15
      • 1970-01-01
      • 1970-01-01
      • 2018-05-12
      • 1970-01-01
      相关资源
      最近更新 更多