I had recently had to use Typescript on an Ubuntu machine, and I could not get it to work. I eventually found out how to fix it; so, I thought I would use this blog post as an opportunity to document the process in case someone else runs into the same problem.
Ensure that you have Git and Node.js installed
Clone a copy of the repo:
Change to the TypeScript directory:
Install Jake and dev dependencies
Make Typscript use nodejs instead of node
At this point, you have installed typescript successfully. However, you need to make it use nodejs instead of node. I know of two approaches:
- Edit /usr/local/bin/tsc
- Change update-alternatives
I suggest you change update-alternatives. However, it will also make all calls to node use nodejs, which may cause you problems. Pick whichever one makes more sense for you.
You can update your alternatives with the following command line argument:
Now, update your PATH to load files from /etc/alternatives first
You can typically by adding the following to $HOME/.bashrc