【问题标题】:VSCode Extension Debugging Node with WSL带有 WSL 的 VSCode 扩展调试节点
【发布时间】:2019-02-11 20:23:55
【问题描述】:

我正在尝试使用 WSL 在 Windows 中调试 vscode 扩展。似乎 prelaunchtask 正在使用 cmd.exe 参数,这会导致 prelaunchtask 因 bash 而失败。

执行任务:npm run watch

/bin/bash: /d: No such file or directory 终端进程 以退出代码终止:127

终端将被任务重用,按任意键关闭它。

有什么想法可以强制调试终端正确发出 bash 参数吗?

【问题讨论】:

    标签: visual-studio-code vscode-extensions


    【解决方案1】:

    您可以通过手动指定扩展启动配置使用的 shell 可执行文件和参数来实现此目的。假设您从 example extension 开始,您可以在 .vscode/tasks.json 中编辑“npm: watch”脚本的任务,强制它在没有额外参数的情况下启动 WSL。

    {
        "type": "npm",
        "script": "watch",
        "problemMatcher": "$tsc-watch",
        "isBackground": true,
        "presentation": {
            "reveal": "never"
        },
        "group": {
            "kind": "build",
            "isDefault": true
        },
        // Force this to use WSL with no additional arguments
        "options": {
            "shell": {
                "executable": "C:\\WINDOWS\\System32\\wsl.exe"
            },
            "args": []
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-06-18
      • 2019-03-15
      • 2022-11-04
      • 2017-08-31
      • 2019-11-27
      • 2021-11-27
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      相关资源
      最近更新 更多