vscode中启用tsc 监视 TS5058解决办法

398 阅读1分钟

错误内容:

error TS5058: The specified path does not exist: 'g:githubTtsconfig.json'.
终端进程“D:\Program Files\Git\bin\bash.exe '-c', 'tsc -p g:\github\T\tsconfig.json --watch'”已终止,退出代码: 1

错误原因:

vscode终端默认配置被改成除cmd.exe外的其它程序

解决方式:

在设置中将启动路径改回cmd即可

操作步骤: 1、点开左下角设置,搜索shell,选择功能 --> 终端,在结果列表中点击任意一个 “在settings.json中编辑即可”

image.png 2、修改settings.json中 “terminal.integrated.shell.windows”选项,将对应value值改为cmd.exe对应路径

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",

image.png

-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

其它解决方式:terminal.integrated.shell.windows废弃后替代方式

"terminal.integrated.profiles.windows" 设置配置集合

terminal.integrated.defaultProfile.windows 设置默认开启的终端

"terminal.integrated.profiles.windows": {
    "PowerShell": {
        "source": "PowerShell",
        "icon": "terminal-powershell"
    },
    "Command Prompt": {
        "path":"C:\\Windows\\System32\\cmd.exe",
        "icon": "terminal-cmd"
    },
    "Windows PowerShell": {
        "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
    },
    "gitbash": { // 注意key的命名
        // 设置并添加git-bash的local安装路径
        "path": "D:\\Program Files\\Git\\bin\\bash.exe"
    }
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",