Install TypeScript on FreeBSD

Update pkg

TypeScript runs on Node, so install Node first. On FreeBSD begin by refreshing the pkg catalog. Fresh metadata prevents not found errors during install:

sudo pkg update

Updating FreeBSD repository catalogue...

Wait for the catalog step to finish. The command changes nothing on its own and is safe to run often.

Install Node

Install Node with pkg. The package already includes npm, so one command sets up both tools:

sudo pkg install www/node

New packages to be INSTALLED...

Approve the install when pkg shows the summary. Open a fresh shell after install so the new paths load correctly.

Verify the install

Confirm that Node and npm answer with version numbers:

node -v

v20.11.0

npm -v

10.2.4

Version output means the setup worked. When a command is not found, repeat the install step and check for typing errors.

Add TypeScript globally

Add one global copy of TypeScript with npm and check the compiler version:

npm i -g typescript

added 1 package in 2s

tsc --version

Version 5.4.5

Any recent compiler version is fine for this course. Open a fresh shell when tsc stays unknown right after install.

Next: TypeScript in Docker

Article author: Arthur Isaev