I am using node version 6.9.2 with npm version 5.4.2 on Windows7. I have installed typescript with the command npm install typescript -g
.
However, when I r
Install node version 6.11 and things work without any changes.
The problem is likely that tsc
is not in the system path.
First, check if tsc
is installed correctly. Open cmd.exe
and type the following.
%AppData%\npm\node_modules\typescript\bin\tsc --version
If there is a version log, then tsc
is installed successfully.
The next thing is to add it in PATH. Write in cmd.exe
setx path "%path%;%AppData%\npm\node_modules\.bin\"
This should solve the issue.
However, if the first command did not log the version,
Check the install location using
npm list -g
If typescript appears in the output, copy the location to the PATH as
setx path "%path%;<--the tsc.exe path-->"
Hope this helps.
Since you installed it globally and you had no error, I can assume that the installation succeeded.
To be sure, you can run this command npm config get prefix
. It will output the path of the folder containing all packages installed globally by npm. I you go to the folder specified by the path, there is a nodes_modules
subfolder. It should contain a typescript folder if the installation succeeded. Then copy the path of the bin
of the typescript folder in your environment variable. You should label the path tsc
.
Then you can use tsc
in command line.