Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm doesn't update tsc version

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.

like image 814
mehran Avatar asked Aug 16 '17 00:08

mehran


2 Answers

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.

like image 165
Daniel Rosenwasser Avatar answered Nov 15 '22 03:11

Daniel Rosenwasser


I believe you need to do

npm install -g typescript@latest

or

npm update -g typescript

As answered enter link description here

like image 34
Aidan McArthur Avatar answered Nov 15 '22 02:11

Aidan McArthur