Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Install Yarn on Linux, macOS, and Windows
#1


    How to Install Yarn on Linux, macOS, and Windows

   

How to Install Yarn on Linux, macOS, and Windows


   

In this section, we will explain the steps to set up the Yarn package manager on different operating systems.


   

Installing Yarn on Linux and macOS


   

You have two options to install Yarn on Linux and macOS: using npm or cURL. Before proceeding with the installation, ensure that Node.js and npm are available on your system.


   

Using npm


   

To install Yarn using npm, follow these steps:

   
           
  1. Open the Terminal and connect to your server using SSH.
  2.        
  3. Run the following command to install Yarn:
  4.    
   
sudo npm install --global yarn
   

After the installation is complete, reopen the Terminal and log in again via SSH to enable Yarn commands.

   

To verify if Yarn has been successfully installed, type the following command:

   
yarn --version

   

Using cURL


   

To install Yarn using cURL on most Linux distributions and macOS, follow these steps:

   
           
  1. Open the Terminal and log in via SSH.
  2.        
  3. Run the following command to install Yarn package manager:
  4.    
   
curl -o- -L https://yarnpkg.com/install.sh | bash
   

Once the installation is finished, reopen the Terminal and connect via SSH to ensure Yarn is accessible.

   

Confirm the installation by checking the Yarn version:

   
yarn --version

   

Using cURL on Debian


   

If you're using Debian, use the following steps to install Yarn using cURL:

   
           
  1. Open the Terminal and connect via SSH.
  2.        
  3. Add the GPG key and verify the authenticity of the downloaded packages:
  4.    
   
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
   

Add the Yarn APT repository to the Debian package repository:

   
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
   

Update the package list and install Yarn:

   
sudo apt update
   
sudo apt install yarn
   

Verify the installation:

   
yarn --version

   

Using cURL on CentOS


   

To install Yarn using cURL on CentOS, follow these steps:

   
           
  1. Open the Terminal and log in to SSH.
  2.        
  3. Add the Yarn repository to the system:
  4.    
   
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
   

Import the repository's GPG key:

   
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
   

Install Yarn using the following command:

   
sudo dnf install yarn
   

Confirm the installation:

   
yarn --version

   

Installing Yarn on Windows


   

To install the Yarn package manager on Windows, follow these steps:

   
           
  1. Download the Yarn installation package from the official website.
  2.        
  3. Run the installer by double-clicking the downloaded .msi file.
  4.        
  5. Click "Next" to proceed.
  6.        
  7. Review the end-user license agreement, accept the terms, and click "Next" to continue.
  8.        
  9. Choose the destination folder for the installation and select "Next" to proceed.
  10.        
  11. Click "Install."
  12.        
  13. Yarn has been successfully installed – click "Finish."
  14.        
  15. Open the Command Prompt application and run the following command to verify the installation:
  16.    
   
yarn --version

   

   

Reply


Messages In This Thread
How to Install Yarn on Linux, macOS, and Windows - by aaron - 08-13-2023, 08:34 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)