繁体   English   中英

带有Windows Subsystem for Linux的Windows 10上VSCode中的Typescript构建任务

[英]Typescript build task in VSCode on Windows 10 with Windows Subsystem for Linux

我的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版本中停止了工作。 不确定如何关联。

我尝试修复了一段时间,但最终放弃了内置的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"
            ]
        }
    ]
}

暂无
暂无

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

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