9

Typescript is updated using the following command:

npm install typescript -g

And latest version 2.4.2 is installed correctly and I can verify it by looking the path shown by folloing command:

npm list typescript -g

but the following command shown older version (1.0.3.0) :

tsc -v

Also looked in TEMP variable and it points to the same path as it showed by npm list.

Also running where tsc in command prompt doesn't show anything and doesn't come up with any error.

mehran
  • 1,314
  • 4
  • 19
  • 33

6 Answers6

14

It's likely that you have an old version of TypeScript installed for Visual Studio, and that the Visual Studio installation is shadowing the one installed through npm. You will probably need to change your PATH variable.

To check, open up a Command Prompt (CMD.exe) and type in

where tsc

If the first items are not associated with Node/npm, and are instead installed in something like C:\Program Files (x86)\Microsoft SDKs\TypeScript\..., then you'll need to configure your system environment variables.

  1. Open up your start menu.
  2. Search for system environment variables
  3. Open the item titled Edit the system environment variables
  4. Ensure that the PATH environment variable has the Node/npm location prioritized over the Visual Studio location.
    1. Also ensure that any newer Visual Studio installation locations are prioritized over older ones.

Also see this answer.

Daniel Rosenwasser
  • 21,855
  • 13
  • 48
  • 61
  • This solved my issue as well. Strangely, after updating env. variables - it still didn't work until I restarted windows. – Mike Aug 03 '19 at 12:14
  • Where does the up-to-date tsc.exe should be located? I don't find it anywhere except of `C:\Program Files (x86)\Microsoft SDKs\TypeScript`. Also tried to update node.js, but I didn't see tsc.exe in there. – Arnon Axelrod Jun 10 '20 at 14:39
3

I believe you need to do

npm install -g typescript@latest

or

npm update -g typescript

As answered enter link description here

3

On windows, Open the command prompt and type: where tsc

This will give you a list of typescript versions your PATH and global settings are pointing to.

Go to the path: C:\xxxxx\Microsoft SDKs\TypeScript

Then delete the older version folder except latest one. Then check your current version again.

Have a good day!

David Castro
  • 1,773
  • 21
  • 21
0

Remove the TypeScript folder from C:\Program Files (x86)\Microsoft SDKs.

double-beep
  • 5,031
  • 17
  • 33
  • 41
0

If you are using IntelliJ IDE try:

Preferences > Language & Frameworks >Typescript

and change Typescript select field to the correct path.

daniel gi
  • 396
  • 1
  • 7
  • 19
-1

the old typescript version must be on that address on windows computer, C:\Program Files (x86)\Microsoft SDKs\TypeScript

so all you have to do is to go to that address by going into c:\ drive and then into program files (x86) folder and then find Microsoft SDKs folder and you will see the typescript folder,you can just cut or delete the folder from there and then come back to cmd and write the path for typescript and it will show you the new path and the latest version.