How To Fix “Tsc Command Not Found” in TypeScript

“Tsc Command Not Found” in TypeScript

If you are having trouble with the error “tsc command not found” in TypeScript, keep reading our article. We will give you some methods to handle the problem.

Reason for error “tsc command not found”

TypeScript Compiler (tsc) is essential to run TypeScripts files. The error “tsc command not found” occurs when you compile a Typescript file. There may be something wrong with the PATH or some error when installing TypeScript or not installing Typescript yet.

Keep going on. We will show you a few solutions to fix this error.

Solutions to fix this problem

Fix it if something wrong with the Path

First, we should recheck the Path. Left click on the Start menu and type “Edit system environment variables” to enter the ‘Environment variables’ theme. Continue left-click on ‘Environment Variables’ in the ‘Advanced’ tab. After that, select ‘Path’ in ‘Variable’ column in ‘User variables’ table and click Edit.

A new tab named ‘Edit environment variable’ appears. Here, look up the Path to the ‘npm’ package. If there is no path like that, you have to create a new one by clicking on the New option and then browse to the ‘npm’ package.

By default, the Path to the package is C:\Users\User_name\AppData\Roaming\npm.

After editing the Path, try to rerun the TypeScript file.

To add Environment Variable in Linux Operating System and MacOS.

Using this syntax:

export PATH=“$PATH:/path/to/the/folder/bin”

Fix it if TypeScript is not installed

This error may occur when you have not installed ‘tsc’ yet. So, you can use ‘npx’ to enable TypeScrip Compiler.

Npx‘ means Node Package Execute which is installed automatically when you install ‘npm’. It is a tool used to execute other packages without installing them.

To run a TypeScript file without installing TypeScript Compiler, use the following command:

npx tsc file.ts

Alternatively, you can install TypeScript Compiler. We strongly recommend installing TypeScript Compiler global.

npm install -g tsc

Fix it if something wrong when installing TypeScript Compiler

When you install TypeScrip, your system may get some trouble which causes the error “tsc command not found”. The error still occurs despite successfully installing TypeScript. To handle this problem, you can reinstall TypeScript Compiler as a solution. First, remove TypeScript by following command:

npm uninstall -g typescript

Then, reinstall it global with the command:

npm install -g typescript


Our article gives you a detailed explanation of the error “tsc command not found” in TypeScript. In addition, we also give you solutions to each sub-problem. We hope you can solve your problem after reading our article. 

Maybe you are interested:

Leave a Reply

Your email address will not be published. Required fields are marked *