VS Code - Failed to start external program tsc.exe

I keep getting "Could not start external tsc.exe program" in VS Code. I 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" 
+7
visual-studio-code
source share
3 answers

You should try installing tsc as follows:

 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 reading this:

https://code.visualstudio.com/Docs/tasks

Well,

I came up with my own solution for creating a modified version of tasks.json every time you run the configuration task (CTR), but I don’t know if this is really a good grade as VSCode is brand new. I have not found a better solution. If anyone knows how to change CTR correctly. Please let me know!

There is a file called taskSampleConfig.json that is parsed every time CTR is executed, and this file is inside the VSCode folder, so you can change it to:

 ... "windows": { "command": "tsc.cmd" }, ... 
+7
source share

Since I cannot comment, I am posting it as an answer:

Since tsc.cmd must be executed in the shell, you need to configure it as follows:

 "windows": { "command": "tsc", "isShellCommand": true } 

The TaskSampleConfig.json file is mainly used as a template if VSCode cannot automatically detect the task runner. There is currently no support for customizing templates.

+3
source share

For me, this works like this (using VSCode in Administrative mode on Win8):

  • Install Typescript via npm (as jrabello wrote)
  • Configure the task as follows:

     "version": "0.1.0", "command": "tsc", "showOutput": "silent", "isShellCommand": true 
  • Create tsconfig.json for your project with the compiler options you need:

     "compilerOptions": { "target": "ES5", "module": "commonjs", "sourceMap": true } 
+3
source share

All Articles