Terminated with exit code: 1 | Lesson 6 Debugging Typescript Applications

On lesson 6 - Debugging Typescript Applications I’m receiving the following pop-up error when trying to debug

The preLaunchTask ‘tsc: build - tsconfig.json’ terminated with exit code 1.

I then choose “Debug Anyway”

Is this something to be concerned about?

2 Likes

Assuming you’re on Windows. From what I can tell from googling around (e.g. node.js - the prelaunchtask ‘tsc build - tsconfig.json’ terminated with exit code 1 - Stack Overflow)

This seem to be a Execution Policy issue. From about Execution Policies - PowerShell | Microsoft Learn I figure Bypass is fine for my own code, so I ran PowerShell as admin, then ‘Set-ExecutionPolicy -ExecutionPolicy Bypass’.

I found I had to close and reopen VSCode though to make the error go away though.

I’m also getting this message too on my mac. I have ‘Oh My ZSH’ installed to my terminal and when I run the debugger I’m getting this message:

" The preLaunchTask ‘tsc: build - tsconfig.json’ terminated with exit code 127."

That sounds like a separate issue. I’d suggest creating a new topic for this, if searching doesn’t find you the answer

@Mosh could we get some further input on how to address this issues?

Yeah, @Mosh; come on now…

I don’t know if this helps any of you guys but I also had a similar problem here and I spent a long time trying to figure it out. I am using WINDOWS just FYI.

I checked google and came across this: typescript - VSCode path generation failure in Run Build Task / tsc: build - Stack Overflow. The first solution didn’t really help me but the second one did.

The problem I had (getting this same message “tsc: build - tsconfig.json’ terminated with exit code 1”) was that I have git bash integrated into the terminal and by default git bash has separators like this “Desktop\Project\Typescript\etc…” instead of the usual “Desktop/Project/Typescript/etc…” (so backslashes instead of forward). For some reason when the file was executed it paths to “DesktopProjectTypescriptetc…” ← which doesn’t exist as a file.

So what I did to solve this was:

  1. open settings with “ctrl” + “,” together
  2. type automation in the search bar
  3. click the link at the bottom:
  4. paste this in :
    “terminal.integrated.automationProfile.windows”: {
    “path”: “cmd.exe”
    }

(runs the program with command line by default)