Hello, friends. In this short and brief post, you will learn how to install Yarn on CentOS 9 Stream.
In a nutshell, Yarn is a package manager for JavaScript that is fully compatible with NPM. To some extent, Yarn improves on many aspects of the standard NPM client. That is, although the functionality is similar, Yarn adds certain enhancements that make the process easier.
Some advantages of Yarn are that it is fast, very reliable and introduces new concepts to make the package management process easy to do.
Install Yarn on CentOS 9 Stream
The Yarn installation process is simple thanks to the good support it provides for Linux. As you can guess, CentOS 9 Stream is no exception.
First we have to install NodeJS because it is a Yarn dependency. To achieve this, we just need to use the version included in the official repositories of the distribution:
sudo dnf update
sudo dnf install nodejs
Then, you will be able to see the version you have installed, running this command
node --version
Output:
v16.14.0
Thereafter, we have to install the curl
package
sudo dnf install curl
The curl
package will be used to add the Yarn repository to the system.
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
Now that the repository has been successfully added, we can install Yarn with this command
sudo dnf install yarn
Then, you can check the installed version
yarn --version
1.22.19
This completes the job.
Conclusion
Yarn is an important tool that can serve not as a replacement for npm, but rather as a new, complementary way to manage JavaScript packages.
Please read more posts about CentOS 9 Stream