Reputation: 509
I am working through the Typescript intro at https://code.visualstudio.com/docs/languages/typescript
When I try to Run Build Task
and choose tsc: build
, VSCode attempts the following:
Executing task: tsc -p c:\work\JavascriptTypescript\test-apr-2018\tsconfig.json <
error TS5058: The specified path does not exist: 'c:workJavascriptTypescripttest-apr-2018tsconfig.json'.
The terminal process terminated with exit code: 1
It is trying to use the full path to the tsconfig.json file, and then stripping the slashes from that path. Obviously this isn't going to find the correct file.
If I manually issue tsc -p tsconfig.json
from the command line, tsc
works correctly.
This seems like a VSCode configuration error, but I am new to VSCode and don't know how to fix it.
Upvotes: 12
Views: 11534
Reputation: 24181
Change the shell for tasks to cmd.exe
"terminal.integrated.automationProfile.windows": {
"path": "C:\\Windows\\System32\\cmd.exe"
}
Now you can keep bash
as a shell for the terminal and build tasks will be executed using cmd.exe
To change that value
Automation
Edit in settings.json
FYI
Can a task use a different shell than the one specified for the Integrated Terminal?
Upvotes: 14
Reputation: 187
If you type the command: "tsc -p c:\work\JavascriptTypescript\test-apr-2018\tsconfig.json" in gitbash you get the same error. If you change it to "tsc -p c:/work/JavascriptTypescript/test-apr-2018/tsconfig.json" It will work
Upvotes: 0
Reputation: 71
Another solution to this problem is to create an npm script that runs tsc, and then run that script in the VSCode launch.json.
package.json:
"scripts": {
"debug": "tsc --sourcemap"
},
.vscode/launch.json:
{
"type": "node",
"request": "launch",
"name": "Debugger",
"program": "${workspaceFolder}/app.ts",
"preLaunchTask": "npm: debug",
"outFiles": [
"${workspaceFolder}/*.js"
]
}
Upvotes: 6
Reputation: 509
This is a known issue (as of 2018-04-20) when using VSCode on Windows with Git Bash as a terminal. See https://github.com/Microsoft/vscode/issues/35593 .
Switching to CMD for a terminal is a workaround. So is invoking tsc manually as described above.
Upvotes: 19