Could not find the task 'tsc: build - tsconfig.json'

I see there are similar topics posted on here but have been unable to troubleshoot this problem from those topics.
In 6- Debugging Typescript applications I hit launch program and am given this warning “Could not find the task ‘tsc: build - tsconfig.json’”.
Can someone please help me fix this issue please?
Using Node v20.7.0 and tsc v5.4.5

1 Like

I have the same problem. I’m using Node v20.12.2 and tsc v5.4.5.

I saw someone posted a similar problem a year ago in this blog, which is the following:

[TypeScript Debugger - The preLaunchTask ‘tsc: build - tsconfig.json’ terminated with exit code 127]

I saw on the comments that a solution was to install “TypeScript specifically for your project in VSCode”. By doing that, the warning disappeared for me, but the debugger was still not working as I expected, because following the course, it says that adding a log helps to visualize that the variable “age” changes to 30:

but my debugger stops right before that 4th line of code and the variable “age” turns to “undefined” again:

I’m not even sure what I’m doing; this is literally the first coding tutorial I’m watching after graduating as an industrial engineer (almost no coding skills) and 1 year of experience working as a SQL developer, nothing else.

I saw on this post something that finally helped me:

In my case, as the program wasn’t located in the same folder as Mosh’s, I had to locate the preLaunchTask in a different location (the one where my program was located).

Instead of just writing “tsc: build - tsconfig.json”, I had to write tsc: build - myfirstrepositiry/TypeScript-Tutorial/tsconfig.json