Typescript: tsc: command not found

Created on 15 Jul 2018  路  14Comments  路  Source: microsoft/TypeScript

tsc: command not found

I reinstalled the Node.js and TS but doesn't work


C:>npm install -g typescript
C:\Users\jorge.herreraAppData\Local\npm\tsserver -> C:\Users\jorge.herreraAppData\Local\npm\node_modules\typescript\bin\tsserver
C:\Users\jorge.herreraAppData\Local\npm\tsc -> C:\Users\jorge.herreraAppData\Local\npm\node_modules\typescript\bin\tsc

C:>tsc --version
"tsc" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.


External

Most helpful comment

Make sure C:\Users\jorge.herrera\AppData\Local\npm\ is on your account's PATH environment variable.

All 14 comments

Make sure C:\Users\jorge.herrera\AppData\Local\npm\ is on your account's PATH environment variable.

Hi bro,

I don't have te npm there

C:\Users\JorgeAppData\Local

What can I do?

Thanks a lot.

Not totally sure, but it sounds like there's something wrong with npm. Otherwise, we really can't investigate, as this doesn't sound TypeScript-specific. I'd recommend trying StackOverflow.

I'll find that it's something wrong with the PATH, but I don't know, I'm continue to try it.

Thanks a lot.

I am seeing the same issue.

C:\Users\Daz>npm install -g typescript
C:\Users\DazAppData\Roaming\npm\tsc -> C:\Users\DazAppData\Roaming\npm\node_modules\typescript\bin\tsc
C:\Users\DazAppData\Roaming\npm\tsserver -> C:\Users\DazAppData\Roaming\npm\node_modules\typescript\bin\tsserver
C:\Users\DazAppData\Roaming\npm
`-- [email protected]

C:\Users\Daz>tsc
'tsc' is not recognized as an internal or external command,
operable program or batch file.

Restarting the terminal doesn't make a difference.

On my Path:

image

I can see tsc in that directory:

image

If I CD into that directory I can run tsc successfully from there:

C:\Users\DazAppData\Roaming\npm>tsc --version
Version 3.1.1

It seems for some reason even though it's on my PATH, it isn't being found..

Assume this is a node / npm issue, will try updating / reinstalling node / npm

The version of node I had installed was quite old. I updated to the latest version, and then ran into this whilst trying to install typescript: https://github.com/npm/npmlog/issues/48

So I uninstalled node completely, deleted all existing node_modules folders, then installed then re-installed the latest version of node. I was then able to successfully install typescript globally, and run tsc from command line.

I just had this and bulldozing node_modules and reinstalling "fixed" it.

Thank you, I had the same problem. it is working by running tsc.cmd file inside the path of C:\Users\yourUsernameAppData\Roaming\npm

it worked after adding ,C:\Users\muhammad.ahmedAppData\Roaming\npm to as "path" to user variables

Have you tried running tsc via npx?

EG:

npx tsc version
instead of
tsc version

this worked for me

npx tsc version works for me as well

You all may want to look into a tool called Volta if you'd like to just be able to type in tsc.

I had the same problem, restarting the machine doesn't help. uninstalling and reinstalling the latest version (14.8.0) of node did the trick. And NO, I didn't have to run it through npx for tsc to work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

remojansen picture remojansen  路  3Comments

wmaurer picture wmaurer  路  3Comments

MartynasZilinskas picture MartynasZilinskas  路  3Comments

uber5001 picture uber5001  路  3Comments

siddjain picture siddjain  路  3Comments