I keep getting the "Failed to launch external program tsc.exe" in VS Code. I have installed typescript and set my path to where tsc.exe is located. Any suggestions Here is my task file
// The command is tsc.
"command": "tsc",
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// Under windows use tsc.exe. This ensures we don't need a shell.
"windows": {
"command": "tsc.exe"
},
// args is the HelloWorld program to compile.
"args": ["HelloWorld.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
You should try to install tsc this way:
npm install -g typescript
And then change tasks.json to:
...
"windows": {
"command": "tsc.cmd"
},
"args" : ["Myfilename.ts"]
...
And everything should work as expected, also, try to read this:
https://code.visualstudio.com/Docs/tasks
Well,
I came up with my own solution to generate modified version of tasks.json each time you config task runner(CTR), but I don't know if this is a really good pratice as VSCode is brand new I've not found a better solution, If anyone knows how to change CTR in the proper way PLEASE let me know!
There is a file called taskSampleConfig.json that is parsed everytime CTR runs, and this file is inside VSCode folder, so you may change it to:
...
"windows": {
"command": "tsc.cmd"
},
...
Since I can't comment yet I post it as an answer:
Since tsc.cmd must be executed in a command interpreter you need to configure it like this:
"windows": {
"command": "tsc",
"isShellCommand": true
}
The taskSampleConfig.json file is basically used as a template if VSCode can't auto detect a task runner. There is currently no support to customize the templating.
For me it works that way (Using VSCode in Admin-Mode on Win8):
Setting up the task like this:
"version": "0.1.0",
"command": "tsc",
"showOutput": "silent",
"isShellCommand": true
Creating a tsconfig.json for your project with the compiler-options you need:
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true
}
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