Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»Nodejs»3 Methods to Install Yarn on Ubuntu, Debian & LinuxMint

    3 Methods to Install Yarn on Ubuntu, Debian & LinuxMint

    By RahulDecember 15, 20223 Mins Read

    Struggling to install Yarn on your Ubuntu, Debian, or LinuxMint system? Don’t worry! With these three simple methods, you’ll be able to install Yarn in no time. Yarn is a powerful package manager that allows you to install, update, and uninstall applications with ease. It also helps you manage multiple versions of libraries and applications, so you can easily switch between them. With these three methods, you can easily install Yarn on your Ubuntu, Debian, or LinuxMint system and get started with your projects! So why wait? Let’s dive in and explore the three methods to install Yarn.

    Advertisement

    Assuming that you already have installed Node.js on Ubuntu or Debian system.

    In this article:

    1. Installing yarn package manager using NPM
    2. Install yarn using official shell script
    3. Install yarn using official PPA

    You can choose any of the 3 methods to install yarn package manager on your system.

    Method 1: Install Yarn using NPM

    The yarn package is available to install with NPM. You can simply use the npm command as follows to install Yarn globally. To install yarn for the current project only just remove the -g option from the command.

    sudo npm install yarn -g 
    

    Check the installed version:

    yarn -v 
    
    1.22.19
    

    Method 2: Install Yarn using Shell Script

    Yarn also provides a shell script for installation. This is the most recommended way to install Yarn on a Linux system. This script downloads the yarn archive and extracts it under the .yarn directory under your home directory. Also, set the PATH environment variable.

    curl -o- -L https://yarnpkg.com/install.sh | bash 
    

    As this installation put all files under the user’s home directory, So it is available for the current users only.

    Method 3: Install Yarn using PPA

    The Yarn team also provides an Apt repository to install yarn on a Debian machine. Run the following commands to import gpg key and configure yarn apt repository.

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list 
    

    Ubuntu 22.04 and Debian 11 or the newer versions, use the following commands to configure the repository:

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

    Now type the following commands to install yarn on Ubuntu Debian and Linux.

    sudo apt-get update && sudo apt-get install yarn 
    

    This will complete the Yarn installation on your system.

    Conclusion

    In this blog post, you have learned 3 methods of installing the yarn package manager on Ubuntu, Debian, or Linux Mint systems. You can choose any of the three methods to install yarn on Linux system.

    NodeJs package manager yarn
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Learn Apt Command Line in Linux

    12 Apt Command Examples in Ubuntu & Debian Linux

    How to list all collections in MongoDB database

    How to Install Grunt on Ubuntu 22.04 & 20.04

    View 1 Comment

    1 Comment

    1. Burak on February 21, 2021 7:38 am

      Thanks a lot.Works great

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.