Ponsiva
Ponsiva

Reputation: 1030

tsc: The term 'tsc' is not recognized as a name of a cmdlet, function, script file, or executable program for configuring TypeScript Program

I got an error while configuring TypeScript Program.

tsc: The term 'tsc' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Upvotes: 1

Views: 1521

Answers (3)

Kalana Wasala
Kalana Wasala

Reputation: 1

1.First, install tsc globally using the terminal :

npm install -g typescript

2.Next, open VS Code and update the settings.json file as follows:

    "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "args": ["-ExecutionPolicy", "Bypass"]
    }
  }

3.Then, close VS Code and open it as administrator and execute the following command in the terminal:

Set-ExecutionPolicy Unrestricted

Upvotes: 0

Karthik
Karthik

Reputation: 280

Install the typescript globally

npm install -g typescript

Upvotes: 1

Ponsiva
Ponsiva

Reputation: 1030

Typescript might not be installed globally for a reason, so do so.

npm install -g typescript // install globally

If you want to convert .ts files into .js, do this as per your need

tsc path/file.ts // file.ts will be converted to file.js
tsc              // all .ts files will be converted to .js files with in the directory
tsc --watch      // converts all .ts files to .js, and watch changes in .ts files

Upvotes: 3

Related Questions