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.
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.
Change the shell for tasks to cmd.exe
"terminal.integrated.automationShell.windows": "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?
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"
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With