How to install Node.js 10 LTS and NPM on FreeBSD 12

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

Welcome to our guide on how to install Node.js 10 LTS on FreeBSD 12. Node.js is a popular free open source server-side programming language that can run on various platforms (Linux, Windows, Unix, MacOS). Code-named “b“. Will be supported until April 2020.

Before, I wrote other articles on FreeBSD 12:

How to install VIM text editor on FreeBSD 12

How to install MariaDB 10.3 on FreeBSD 12

How to install PHP 7.2 on FreeBSD 12

Install Node.js 10 LTS on FreeBSD 10

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine, which can easily build fast and scalable web applications. To install Node.js 10.x LTS on FreeBSD 12, use pkg Parcel manager.

To view the available Node 10 versions available on FreeBSD 12, use:

$ su -
# pkg search node-10
node-10.11.0                   V8 JavaScript for client and server

From the output, you can see that we have Node 10.11.0 Available in the FreeBSD repository. Use the following command to install it:

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

New packages to be INSTALLED:
	node: 10.11.0
	c-ares: 1.14.0_1
	libuv: 1.23.1

Number of packages to be installed: 3

The process will require 32 MiB more space.
6 MiB to be downloaded.

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

When prompted for input y/n Confirm, press y. The following is the installation sample output

[1/3] Fetching node-10.11.0.txz:  85%    5 MiB 278.5kB/s    00:03 ETA

[1/3] Fetching node-10.11.0.txz: 100%    6 MiB 125.0kB/s    00:49    
[2/3] Fetching c-ares-1.14.0_1.txz: 100%  122 KiB 124.7kB/s    00:01    
[3/3] Fetching libuv-1.23.1.txz: 100%   99 KiB 101.3kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/3] Installing c-ares-1.14.0_1...
[1/3] Extracting c-ares-1.14.0_1: 100%
[2/3] Installing libuv-1.23.1...
[2/3] Extracting libuv-1.23.1: 100%
[3/3] Installing node-10.11.0...
[3/3] Extracting node-10.11.0: 100%
Message from node-10.11.0:

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

You can use the following command to confirm the installed Node.js version:

# node --version
v10.11.0

For more information about packages (such as dependencies), see pkg infoOutput.

# pkg info node-10.11.0
node-10.11.0
Name           : node
Version        : 10.11.0
Installed on   : Thu Dec 13 20:17:11 2018 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    : on
	DOCS           : on
	DTRACE         : on
	NLS            : on
Shared Libs required:
	libicudata.so.62
	libcares.so.2
	libnghttp2.so.14
	libicuuc.so.62
	libicui18n.so.62
	libuv.so.1
Annotations    :
	FreeBSD_version: 1200086
	repo_type      : binary
	repository     : FreeBSD
Flat size      : 30.8MiB
Description    :
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript
engine. Node.js uses an event-driven, non-blocking I/O model that
makes it lightweight and efficient. Node.js' package ecosystem,
npm, is the largest ecosystem of open source libraries in the world.

WWW: https://nodejs.org/

Install Node Package Manager

After installing Node.js 10, you can install NPM, which 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 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	npm: 6.4.1
	gmake: 4.2.1_2

Number of packages to be installed: 2

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

Proceed with this action? [y/N]: y
[1/2] Fetching npm-6.4.1.txz: 100%    3 MiB 211.5kB/s    00:15    
[2/2] Fetching gmake-4.2.1_2.txz: 100%  381 KiB  65.1kB/s    00:06    
Checking integrity... done (0 conflicting)
[1/2] Installing gmake-4.2.1_2...
[1/2] Extracting gmake-4.2.1_2: 100%
[2/2] Installing npm-6.4.1...
[2/2] Extracting npm-6.4.1: 100%

Test your npm through installation PM2 Node.js process manager

# npm install pm2 -g
/usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev
/usr/local/bin/pm2-docker -> /usr/local/lib/node_modules/pm2/bin/pm2-docker
/usr/local/bin/pm2-runtime -> /usr/local/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/pm2/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 313 packages from 243 contributors in 35.691s

Enjoy the fun of developing with Node.js 10 on FreeBSD 12.

The
You can download this article in PDF format to support us through the following link.

Download the guide in PDF format

turn off
The

The
The

Sidebar