Installing TypeScript on Ubuntu 14.04

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.

Building

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.

Edit /usr/local/bin/tsc

Change

To this

Change update-alternatives

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

Advertisements

One thought on “Installing TypeScript on Ubuntu 14.04

  1. Hi, none of the ending steps work for me. For the first step I don’t find such a file to change its contents (/usr/local/bin/tsc) and for the second step it replying with `update-alternatives: error: alternative link /usr/bin/node is already managed by node`.

    Do you have any idea how I can proceed?
    `

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s