1
votes

I'm new here to Typescript and I'm trying to install it globally on my machine.

I currently have the following versions: Node v.11.13.0 npm v6.7.0

When I run npm install -g typescript I get the following results:

C:\Users[userid].node_modules_global\tsc -> C:\Users[userid].node_modules_glob al\node_modules\typescript\bin\tsc C:\Users[userid].node_modules_global\tsserver -> C:\Users[userid].node_modules _global\node_modules\typescript\bin\tsserver + [email protected] updated 1 package in 3.297s

The moment I run tsc or tsc -v on my command line, I receive the

'tsc' is not recognized as an internal or external command, operable program or batch file.

I have uninstalled node and reinstalled it, but I still get the same error.

I have consulted Google and followed other methods on Stackoverflow to fix this problem, including checking the PATH folder structure.

I am not sure what I am doing wrong here, please help. FYI I am running a Windows 7 PC.

2

2 Answers

1
votes

In your command prompt, try executing the below command,

set path=%PATH%;c:\Users\YOUR_USER_DIRECTORY\AppData\Roaming\npm;

Then try executing your tsc command again, you will get it executed now.

Hope this helps!

0
votes

FOUND IT!

Ok so I dug around and discovered the following: Under User\[pc_name]\.node_modules_global I found the tsc and tsc.mcd files. All I did was copy those two files across to ...\Roaming\npm. After doing that I ran tsc in my command prompt and it worked!