How to install NodeJS on FreeBSD 12?

Windows Articles

How to get the Nextcloud desktop client on Linux?

Hello friends. We already know how to install a Nextcloud server but now the client is missing. So in this post, you...

How to Backup your call and SMS history in Android

Many times we find ourselves in the situation of having to change our phone, for different reasons, and one of the questions...

Install and configure Apache Guacamole on Debian 10

Hello, friends in this post, you will learn how to install and configure Apache Guacamole in Debian 10. It will be a...

Ubuntu 20.10 available

The new version of Ubuntu is now available, under the code name "groovy gorilla". Ubuntu 20.10 focuses on improving and refining the...

Monitoring Ubuntu 20.04 with Stacer

Normally if we use Linux on a production server, it is important to monitor it. On the other hand, in everyday use, many users...
angeloma
angeloma
Senior Writer and partner

Hello. In this short post, I will show you how to install NodeJS on FreeBSD 12. Also, I will install NPM too.

What is NodeJS

If you are an expert developer or already have some experience with it, you will know it is NodeJS. However, in case you are starting with it, it is a good idea to know what NodeJS is first.

NodeJS is a technology that allows running Javascript on the server-side using Google’s V8 engine. It is a real revolution in the way web applications are developed because it reduces the asymmetry of client and server performance.

Many important forms such as Linkedin or eBay were created using this technology. This shows us the power of NodeJS.

An advantage of NodeJS is that its syntax is similar to that of Javascript and therefore its learning curve decreases a lot.

So, let us start.

Install NodeJS on FreeBSD 12

First of all, all the commands we will use require you to be root. So it is a good idea to have sudo enabled and not work directly with the root user.

How to enable sudo on FreeBSD 12?

Now it is also convenient to do a system upgrade. Not only to install security patches but also to refresh the repositories.

:~$ sudo pkg update

The official FreeBSD repositories include NodeJS. So first we’ll search for them.

:~$ sudo pkg search node
bitcoinnodestats-g20171121_1 Basic Bitcoin node status and statistics web application
gstreamer-plugins-annodex-0.10.31_2,3 Gstreamer annodex CMML plugin
kadnode-2.2.5_1 P2P name resolution daemon
leafnode-1.11.11 NNTP package for offline news caching and reading
monodevelop-7.6.11.7_2 IDE for the .NET platform
munin-node-2.0.52 Node-specific part of Munin
node-13.3.0 V8 JavaScript for client and server
node-thrift-0.11.0 Node.js bindings for the Apache Thrift RPC system
node10-10.17.0 V8 JavaScript for client and server
node12-12.13.1 V8 JavaScript for client and server
node8-8.16.2 V8 JavaScript for client and server (8.x LTS)
node_exporter-0.18.1 Prometheus exporter for machine metrics
npm-node10-6.12.1 Node package manager
npm-node12-6.12.1 Node package manager
npm-node8-6.12.1 Node package manager
p5-Tree-DAG_Node-1.31 Super class for representing nodes in a tree
p5-Tree-Node-0.08_2 Memory-efficient tree nodes in Perl
p5-WebService-Linode-0.29 Perl Interface to the Linode.com API
p5-XML-Node-0.11_1 Perl5 module to extend and simplify XML::Parser
p5-XML-NodeFilter-0.01_1 XML::NodeFilter is an object that know how to "filter out" nodes
py27-certbot-dns-linode-1.0.0 Linode DNS Authenticator plugin for Certbot
py27-nodeenv-1.3.3 Node.js virtual environment builder
py37-certbot-dns-linode-1.0.0 Linode DNS Authenticator plugin for Certbot
py37-nodeenv-1.3.3 Node.js virtual environment builder
yarn-node10-1.19.1 Package manager for node, alternative to npm
yarn-node12-1.19.1 Package manager for node, alternative to npm
yarn-node8-1.19.1 Package manager for node, alternative to npm
1.- Search for nodejs on the FreeBSD repositories
1.- Search for nodejs on the FreeBSD repositories

As you can see from the screen output, there are several versions of NodeJS in the official repositories. At the time of writing this post, series 12 is the latest LTS and therefore the most reliable option.

So let’s install NodeJS with the following command:

:~$ sudo pkg install node12
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:
node12: 12.13.1
libnghttp2: 1.40.0
c-ares: 1.15.0_1
libuv: 1.34.0
icu: 65.1,1
Number of packages to be installed: 5
The process will require 86 MiB more space.
18 MiB to be downloaded.
Proceed with this action? [y/N]:
2.- Install NodeJS on FreeBSD 12
2.- Install NodeJS on FreeBSD 12

Now check the version of NodeJS installed with the following command:

:~$ node --version
v12.13.1

It is now convenient to install NPM.

Again, search for the package NPM.

:~$ sudo pkg search npm
Password:
npm-6.12.1 Node package manager
npm-node10-6.12.1 Node package manager
npm-node12-6.12.1 Node package manager
npm-node8-6.12.1 Node package manager
3.- NPM packages available on the official repositories
3.- NPM packages available on the official repositories

As you can see in the image, there are several versions of NPM. Each of them depends on a specific version of NodeJS. Since we have installed NodeJS version 12, then we have to install NPM for that version.

:~$ sudo pkg install npm-node12
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:
npm-node12: 6.12.1
python27: 2.7.17_1
libffi: 3.2.1_3
gmake: 4.2.1_3

Number of packages to be installed: 4

The process will require 90 MiB more space.
15 MiB to be downloaded.

Proceed with this action? [y/N]:
4.- Install NPM on FreeBSD 12
4.- Install NPM on FreeBSD 12

And that is it. Now you can use NodeJS without problems.

Conclusion

NodeJS is a rather interesting technology that is becoming increasingly popular in large web projects. So it’s always good to have it in our system. Today you have learned that installing it on FreeBSD 12 is quite simple.

Please share this post with your friends and join our Telegram channel.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to get the Nextcloud desktop client on Linux?

Hello friends. We already know how to install a Nextcloud server but now the client is missing. So in this post, you...

How to Backup your call and SMS history in Android

Many times we find ourselves in the situation of having to change our phone, for different reasons, and one of the questions...

Install and configure Apache Guacamole on Debian 10

Hello, friends in this post, you will learn how to install and configure Apache Guacamole in Debian 10. It will be a...

Ubuntu 20.10 available

The new version of Ubuntu is now available, under the code name "groovy gorilla". Ubuntu 20.10 focuses on improving and refining the...

Monitoring Ubuntu 20.04 with Stacer

Normally if we use Linux on a production server, it is important to monitor it. On the other hand, in everyday use, many users...
x