Install typescript for Ubuntu via npm vs using native packges (via apt)

Viewed 479

I want to add typescript to my Ubuntu and there are two methods for that:

  1. sudo apt update && sudo apt install node-typescript -y
  2. sudo npm install -g typescript

My question is more than just typescript, I want to know whether there is a benefit in any of those ways. Probably the native packages are not the very latest version so npm wins, or on the other hand, apt may prepare more control on update or maintenance. How can these 2 approaches be compared?

1 Answers

Official Installation

The official TypeScript download page lists three ways for the installation, via:

  • a npm module
  • a NuGet package
  • a Visual Studio extension

They present the following install command: npm install typescript --save-dev

Difference

As one of the official ways covers the TypeScript npm module (which can be found here), you can be sure that it provides the latest release, published by the TypeScript team itself.

For a specific Linux distro, the executables are provided, maintained, and published by the team responsible for that distro's package manager. So you may end up with an outdated version of TypeScript ‍♂️.

For example, with Ubuntu you can find all the TypeScript apt packages here.

Related