In Linux Mint, I've installed node and used it to install typescript. With a working typescript installation, tsc --version
should return the version number. In my case, nothing is returned at all.
When I run which tsc
the result is /usr/local/bin/tsc
.
When I run cat /usr/local/bin/tsc
the result is:
#!/usr/bin/env node
require('../lib/tsc.js')
When I run find /usr/local -name 'tsc*'
the result is:
/usr/local/bin/tsc
/usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/lib/node_modules/typescript/lib/tsc.js
Does that look correct? If so, then any ideas on what else to look at would be appreciated?
Note I also tried running /usr/local/lib/node_modules/typescript/bin/tsc --version
and got the same result ie nothing.
To solve the error "tsc: command not found", install the typescript package globally by running npm install typescript@latest -g or use the npx command with the --package flag, e.g. npx --package typescript tsc --init . The fastest way to solve the error is to use the npx command with the --package flag. Copied!
To solve the error "tsc is not recognized as an internal or external command, operable program or batch file", install typescript globally by running npm install typescript@latest -g or prefix tsc with npx , e.g. npx --package typescript tsc --init .
Tsc stands for `TypeScript compiler` and is a simple tool included in Typescript itself, allowing you to compile any ts files into js.
In my case on Ubuntu 16.04 the problem was because of I performed sudo apt-get install node-typescript
, which delivered me broken tsc. After removing it via apt-get remove
and then installing as recommended with npm install -g typescript
, it worked fine.
Maybe this will help someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With