Search code examples
node.jstypescriptlinux-mint

What's wrong with my typescript compiler? `tsc --version` returns nothing


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.


Solution

  • I discovered that running node --version returns nothing (but shouldn't) however nodejs --version works (the result being v0.10.25). Reinstalling node didn't fix this. I don't know why this would be the case, as I think I followed the recommended installation procedure.

    However, editing file /usr/local/bin/tsc and changing the line:

    #!/usr/bin/env node
    

    to

    #!/usr/bin/env nodejs
    

    seemed to work. Now tsc --version returns message TS6029: Version 1.6.2 and I'm getting .js files generated when I run make.