2

我的 VSCode 设置(在我的情况下是工作区设置)设置为bash用作默认终端:

{
   "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\bash.exe"
}

我需要这个才能调试我的应用程序。

我的tasks.json样子是这样的:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "./tsconfig.json",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

因此,当我尝试构建我的项目/运行构建任务(即Ctrl + B)时,我收到以下错误:

> 执行任务:tsc -p "c:\PATH_TO_MY_PROJECT\tsconfig.json" <

错误 TS5058:指定的路径不存在:'c:\PATH_TO_MY_PROJECT\tsconfig.json'。

终端进程以退出代码终止:1

如果我bash在设置中禁用并使用默认的 Windows 终端,则构建工作正常。

我记得它在几个 VSCode 更新前工作过,但它在最新的 VSCode 版本中停止工作。不知道这有什么关系。

4

1 回答 1

0

我尝试修复了一段时间,但最终放弃了内置的 Typescript 任务,而是使用了自定义任务:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Typescript watch",
            "type": "shell",
            "command": "tsc --watch",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "always",
                "panel": "new"
            },
            "problemMatcher": [
                "$tsc"
            ]
        }
    ]
}
于 2019-08-15T16:24:05.530 回答