Pregunta

I have version 0.9.1.1. So I ran the following:

C:\test>npm install -g typescript
npm http GET https://registry.npmjs.org/typescript
npm http 200 https://registry.npmjs.org/typescript
npm http GET https://registry.npmjs.org/typescript/-/typescript-1.0.0.tgz
npm http 200 https://registry.npmjs.org/typescript/-/typescript-1.0.0.tgz
C:\Users\david\AppData\Roaming\npm\tsc -> C:\Users\david\AppData\Roaming\npm\nod
e_modules\typescript\bin\tsc
typescript@1.0.0 C:\Users\david\AppData\Roaming\npm\node_modules\typescript

But when I run tsc I get:

C:\test>tsc
Version 0.9.1.1
Syntax:   tsc [options] [file ..]

What else do I need to do to install the latest version?

Update:

C:\test>where tsc
C:\Program Files (x86)\Microsoft SDKs\TypeScript\tsc.exe
C:\Program Files (x86)\Microsoft SDKs\TypeScript\tsc.js
C:\Users\david\AppData\Roaming\npm\tsc
C:\Users\david\AppData\Roaming\npm\tsc.cmd

tsc.exe is 0.9.1.1 and tsc.cmd is 1.0.0.0

I then removed the VisualStudio 0.9.1.1 AddIn and it's now all good - just tsc.cmd and that's 1.0.0.0

Thank you all!

¿Fue útil?

Solución

What else do I need to do to install the latest version?

It is because you probably (almost definitely) have TypeScript plugin for visual studio installed. You can uninstall that from Control Panel. Then the typescript you installed from npm will be the default one on the command line.

Alternatively you can get the latest TypeScript from Visual Studio 2012 plugin from here : http://www.typescriptlang.org/#Download (For VS 2013 it is bundled as a part of VS 2013 update 2 RC)

Otros consejos

Removing C:\Program Files (x86)\Microsoft SDKs\TypeScript\ from PATH environment variable did the job for me.

Advanced system settings -> Environment Variables -> system variables -> PATH

TypeScript Version Issues and How to Update using NPM

I had a similar issue, whereby I downloaded both 1.4 and the beta version of 1.5, when I ran the command tsc -v, it kept returning version 1.0...

When I went to the folder indicated above, I saw three versions 1.0, 1.4. and 1.5. deleting 1.0 allowed 1.5 to run...

enter image description here

For me, I just change the "Path" environment parameter from "C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0" to "C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5", then it's all ok.

Before you do this make sure you have typed in

npm install -g typescript

I went to

C:\Program Files (x86)\Microsoft SDKs\TypeScript\

And deleted the 1.0 folder After doing that I did tsc -v on the command line and it finally returned 2.7 as shown below.

PS c:\users\username> tsc -v
Version 2.7.2

How Do I install TypeScript?

First we have to install the node.js. Download it from this location

https://nodejs.org/en/download/

and run the .msi installer, to check whether it is installed or not just use below command in command prompt

node -v

It would display the version of the installed node.js.

Then use below command in command prompt to install the TypeScript

npm install -g typescript

You installed it correctly but while calling the compiler you just need to mention the path of the source file,something like this:

C:\test>tsc example.ts

Check this link for more information

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top