Install Node.js 16 LTS on FreeBSD 13/12

Posted on 13 views

Welcome to our guide on how to install Node.js 16 LTS on FreeBSD 12 / FreeBSD 13. Node.js is a popular free and open source server-side programming language which runs on various platforms (Linux, Windows, Unix, MacOS). The Node 16 LTS codenamed “Gallium“.  will remain supported until April 2024.

Earlier on I had written other articles on FreeBSD systems:

Install Node.js 16 LTS on FreeBSD 13 / FreeBSD 12

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine for easily building fast, scalable network applications. To install Node.js 16.x LTS on FreeBSD 12 / FreeBSD 13, use pkg package manager.

Perform an update on FreeBSD:

freebsd-update fetch
freebsd-update install

See available Node 16 version available on FreeBSD 12 / FreeBSD 13, use:

$ su -
# pkg search node-16
node-16.10.0                   V8 JavaScript for client and server

From the output, you can see we have Nod6 16 LTS available on FreeBSD repository. Install it using the command:

# pkg install node-16.10.0
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 5 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	brotli: 1.0.9,1
	c-ares: 1.17.2
	icu: 69.1,1
	libuv: 1.42.0
	node: 16.10.0

Number of packages to be installed: 5

The process will require 89 MiB more space.
18 MiB to be downloaded.

Proceed with this action? [y/N]: y

When prompted for a y/n confirmation, press y. Below is the installation sample output

[1/5] Fetching node-16.10.0.pkg: 100%    7 MiB   7.8MB/s    00:01
[2/5] Fetching c-ares-1.17.2.pkg: 100%  142 KiB 145.2kB/s    00:01
[3/5] Fetching libuv-1.42.0.pkg: 100%  117 KiB 119.6kB/s    00:01
[4/5] Fetching icu-69.1,1.pkg: 100%   10 MiB  10.9MB/s    00:01
[5/5] Fetching brotli-1.0.9,1.pkg: 100%  355 KiB 363.6kB/s    00:01
Checking integrity... done (0 conflicting)
[1/5] Installing c-ares-1.17.2...
[1/5] Extracting c-ares-1.17.2: 100%
[2/5] Installing libuv-1.42.0...
[2/5] Extracting libuv-1.42.0: 100%
[3/5] Installing icu-69.1,1...
[3/5] Extracting icu-69.1,1: 100%
[4/5] Installing brotli-1.0.9,1...
[4/5] Extracting brotli-1.0.9,1: 100%
[5/5] Installing node-16.10.0...
[5/5] Extracting node-16.10.0: 100%
=====
Message from node-16.10.0:

--
Note: If you need npm (Node Package Manager), please install www/npm.

Node.js version installed can be confirmed with:

# node --version
v16.10.0

More information about the package like dependencies can be seen from the pkg infooutput.

# pkg info node-16.10.0
node-16.10.0
Name           : node
Version        : 16.10.0
Installed on   : Mon Dec  6 18:22:14 2021 UTC
Origin         : www/node
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : www
Licenses       : MIT
Maintainer     : [email protected]
WWW            : https://nodejs.org/
Comment        : V8 JavaScript for client and server
Options        :
	BUNDLED_SSL    : off
	DOCS           : on
	DTRACE         : on
	NLS            : on
Shared Libs required:
	libcares.so.2
	libbrotlidec.so.1
	libnghttp2.so.14
	libicudata.so.69
	libuv.so.1
	libbrotlienc.so.1
	libicuuc.so.69
	libicui18n.so.69
Annotations    :
	FreeBSD_version: 1202000
	repo_type      : binary
	repository     : FreeBSD
Flat size      : 36.9MiB
...

Install Node Package Manager on FreeBSD 13 / FreeBSD 12

After installing Node.js 10, you can install NPM that will help you manage Node packages.

# pkg install npm
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	gmake: 4.3_2
	mpdecimal: 2.5.1
	npm: 6.14.8
	python38: 3.8.12

Number of packages to be installed: 4

The process will require 139 MiB more space.
21 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/4] Fetching npm-6.14.8.pkg: 100%    4 MiB   3.7MB/s    00:01
[2/4] Fetching python38-3.8.12.pkg: 100%   17 MiB  17.9MB/s    00:01
[3/4] Fetching mpdecimal-2.5.1.pkg: 100%  321 KiB 329.0kB/s    00:01
[4/4] Fetching gmake-4.3_2.pkg: 100%  416 KiB 425.7kB/s    00:01
Checking integrity... done (0 conflicting)
[1/4] Installing mpdecimal-2.5.1...
[1/4] Extracting mpdecimal-2.5.1: 100%
[2/4] Installing python38-3.8.12...
[2/4] Extracting python38-3.8.12: 100%
[3/4] Installing gmake-4.3_2...
[3/4] Extracting gmake-4.3_2: 100%
[4/4] Installing npm-6.14.8...
[4/4] Extracting npm-6.14.8: 100%
=====
Message from python38-3.8.12:

--
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

py38-gdbm       databases/[email protected]
py38-sqlite3    databases/[email protected]
py38-tkinter    x11-toolkits/[email protected]

Test your npm by installing PM2 process Manager for Node.js

# npm install pm2 -g
/usr/local/bin/pm2-runtime -> /usr/local/lib/node_modules/pm2/bin/pm2-runtime
/usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/bin/pm2-docker -> /usr/local/lib/node_modules/pm2/bin/pm2-docker
/usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]~2.3.2 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted "os":"darwin","arch":"any" (current: "os":"freebsd","arch":"x64")

+ [email protected]
added 180 packages from 200 contributors in 14.343s

Enjoy developing with Node.js 16 LTS on FreeBSD 12 / FreeBSD 13 systems.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.