23.2 C
Senior Writer and partner

How to install yarn on FreeBSD 12?

In the development of any application, there are dependencies that we have to handle. With time, these can become a problem so it is convenient to have a tool that does it for us. In the case of Javascript, we have a very good one. So, in this post, I will show you how to install Yarn on FreeBSD 12.

Yarn is a Javascript dependency manager that stands out for being fast, secure and reliable. It is presented to us as the most solid alternative to NPM. In addition, it is open source and it has the protection of a giant like Facebook what guarantees us solidity and robustness of the project. Some of its characteristics are the following:

  • Fast: Yarn caches every package it has downloaded.
  • Reliable: Using a detailed but concise lockfile format and a deterministic algorithm for install operations.
  • Secure: Yarn uses checksums to verify the integrity of every installed package before its code is executed.

There are also other features such as its efficiency in the use of the network as well as an offline mode. All this can be found on the Github site of Yarn.

So, let us start.

Install Yarn on FreeBSD 12

- Advertisement -

For this tutorial, you must have sudo enabled, so this is the first step.

How to enable sudo on FreeBSD 12?

After you can use sudo, you can continue.

The FreeBSD 12 repositories are quite large, so we will first look for yarn in them.

Open a terminal and run the following:

:~$ sudo pkg search yarn
yarn-1.19.1                    Package manager for node, alternative to npm
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.- Searching for yarn
1.- Searching for yarn

As you can see in the picture, yarn is in the official repositories. And also, they have several versions according to the version of NodeJS we have installed.

However, to install it, just use the following command:

:~$ sudo pkg install yarn
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 6 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	yarn: 1.19.1
	node: 13.3.0
	libnghttp2: 1.40.0
	c-ares: 1.15.0_1
	libuv: 1.34.0
	icu: 65.1,1

Number of packages to be installed: 6

The process will require 92 MiB more space.
19 MiB to be downloaded.

Proceed with this action? [y/N]:

2.- Install Yarn on FreeBSD 12
2.- Install Yarn on FreeBSD 12

Once it is installed, you can check the installed version.

:~$ yarn --version

3.- Yarn version
3.- Yarn version

This indicates that yarn is ready for action.

Basic use of Yarn

Now we will look at some basic steps in the use of yarn. I’m going to create a sample project, and for that I’ll first create a new dedicated folder.

:~$ mkdir project

Now I’ll access it:

cd project/

And within it, I initiate the yarn project. This will make me ask some questions about the configuration of the project. Nothing complicated.

:~$ yarn init
yarn init v1.19.1
question name (project): Example
question version (1.0.0): 
question description: This is an example
question entry point (index.js): 
question repository url: https://www.osradar.com/
question author: Angelo
question license (MIT): 
question private: no
success Saved package.json
Done in 34.27s.

4.- Creating a new project with Yarn
4.- Creating a new project with Yarn

If you want to add a new dependency, just use the following command:

:~$ yarn add [name]

Or to eliminate it:

:~$ yarn remove [name]

And from the project folder, we can install the rooms:

:~$ yarn

And so we can continue with the installation.


Yarn is a fantastic tool for Javascript developers and thus makes it easier to create functional web applications. Now you know how to install it on FreeBSD 12.

Please share this post and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article