Yarn is a package manager made by Facebook for the system to be created. Never heard of a package manager? A package manager is a package of installing, updating, configuring and removing software. So if you install using a package manager, you don't need to configure it separately. You only need to enter certain commands such as add or install. How to install Yarn on Hosting is also very easy for beginners.

What is Yarn?

With Yarn, you can use and share your code with other developers around the world. Quoted from Yarnpkg, Yarn is claimed to be faster, safer and more reliable. If there is a problem, you can report the problem and contribute with other developers. Some of the code is disseminated through the media which is usually called a "package" or "module". Each package contains all the shared code (called package.json). Actually, this yarn functions almost similar to npm. Do you still remember what npm is? Npm is a package manager for JavaScript which is commonly used to perform several software installations such as Node.js, Express.js, and so on.

What is the difference between Yarn and npm?

Actually Yarn and npm are both Javascript package managers. Quoted from KeyCDN , the difference between Yarn and npm lies in the way of installation, speed, security and the presence of a lock file.

Installing the Package Manager

You have to install npm sequentially. This means that you cannot take the next step if the previous step has not been completed. Unlike Yarn, you can do several installations at one time. Of course, this is more flexible and faster.

Speed

Yarn is always faster when compared to npm which has a version below 5.0. Quoted from Scott Logic's experiment , Yarn is still faster when compared to npm 4 and 5.

Security

Yarn is considered safer and more secure than npm. This is because Yarn only runs packages from the yarn.lock or package.json file. Meanwhile, npm runs system code from various dependencies. In addition, Yarn also provides a checksum before installing.

Lock File

Yarn has a yarn.lock file to make it easier for users to add new modules.

How to Install Yarn on Hosting

You can follow step by step how to install Yarn on the following Hosting.

1. SSH access to Hosting

To install Yarn, you need access to the Hosting server via SSH using the Terminal or PuTTy Software. For you Linux or Mac users, you can use the terminal. For you Windows users, you can use PuTTy software. If you don't know how, please read the SSH Access Guide . Please write the following command in Terminal / PuTTy. Keep in mind that SSH can only be done at a minimum of Super Hosting Packages .

ssh username @ controlpanelURL –p 64000

2. Install Yarn on Hosting

To install Yarn, please write the following command.

npm i yarn-install

how to install yarn in hosting

Wait for the process to complete. After that, don't forget to activate the yarn-install.js file with the command,

./node_modules/yarn-install/bin/yarn-install.js

3. Adding the Application Package

Okay, now Yarn has been successfully installed. Then how do you add applications to Yarn? We know Yarn is a package manager. A package manager is a package of installing, updating, configuring and removing software / application packages. So, of course you can easily add packages / modules to your hosting via Yarn. Write the following command,

yarn add package name

You can search for a list of applications at https://yarnpkg.com/en/packages .

how to install yarn in hosting

For example, this tutorial will install express.js using Yarn. As for how,

yarn add express

To activate express.js, please write,

./node_modules/yarn-install/bin/yarn-install.js add express

4. Deleting the Application Package

To delete a package, please write the following command,

./node_modules/yarn-install/bin/yarn-install.js remove the package name

For example: ./node_modules/yarn-install/bin/yarn-install.js remove express

Comparison of Yarn Speed ​​and NPM

To compare Yarn and NPM speeds you can experiment by writing the following command,

The following command is used to find out the time it takes for NPM to install the express.js package

After that, try experimenting to find out how long it will take Yarn to install express.js.

 

time ./node_modules/yarn-install/bin/yarn-install.js add express

From the results of these experiments, it can be concluded that Yarn has more speed than NPM.

Conclusion

There are several package managers that you can choose from, including NPM or Yarn. Each of these package managers has its own strengths and weaknesses. In terms of speed, Yarn is indeed superior when compared to npm which has a version below 5.0. How to install Yarn on Hosting is also easier because you can do several installations at one time. Do you want to have cheap hosting with the best quality? Try following the Tips for Choosing a Hosting for Beginners so that you know better how hosting is right for you!

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.