Logo

How to Install Yarn on Ubuntu 24.04

Mar 17, 2024

To install Yarn on Ubuntu 24.04, you can choose between using NPM or adding the Yarn repository directly.

Using NPM

Step 1 : Check the version of npm and Node.js.

npm -v
node -v

Step 2 : Install Yarn using npm.

npm install -g yarn

Step 3 : Check the installed Yarn version.

yarn --version

Using Yarn Repository

Step 4 : Add the Yarn GPG key.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/yarn-keyring.gpg

Step 5 : Add the Yarn repository to your system.

echo "deb [signed-by=/usr/share/keyrings/yarn-keyring.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list > /dev/null

Step 6 : Update the package list.

sudo apt update

Step 7 : Install Yarn.

sudo apt install yarn

Step 8 : Check the installed Yarn version.

yarn --version

Congratulations! You have successfully installed Yarn on your Ubuntu 24.04 system.

Recommended