How to install yarn on FreeBSD 12?

Windows Articles

Top 8 features for power users in Windows 10

Hello! Windows 10 is full of features and functions. In fact, that's one of the reasons it's so popular and used. Because it can...

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...
angeloma
angeloma
Senior Writer and partner

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

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.

Conclusion

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.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Top 8 features for power users in Windows 10

Hello! Windows 10 is full of features and functions. In fact, that's one of the reasons it's so popular and used. Because it can...

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...
x