VSCode path generation failure in Run Build Task / tsc: build
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
- open settings editor CTRL+, or File->Preferences->Settings
- in a search, type
Automation
- Select
Edit in settings.json
FYI
Can a task use a different shell than the one specified for the Integrated Terminal?
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.
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"
]
}