• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Yarn on Debian 10 Buster

Written by Admin, Updated On May 9, 2020
debian, nodejs, npm, yarn
How to Install Yarn on Debian 10

Yarn is a fast and reliable JavaScript package manager. Which allows to install, update, configure, and remove npm packages with multiple benefits over npm. It solves the problems with npm and includes faster rate of package downloads, ability to download offline packages, reduce connectivity issues and auto-generation of lock files. This tutorial explains how to install Yarn on Debian 10 system.

Install Yarn on Debian 10#

Before starting yarn installation, don’t forgot to install Node.js on your system.

Follow the below steps as root or user with sudo privileges to install Yarn on Debian 10:

Step 1 – Import GPG Key#

Yarn repository includes the Yarn package. To import the repository’s GPG key and enable apt repository, run the following commands:

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

Step 2 – Install Yarn#

Once the repository is enabled, update the package index and install Yarn, type:

sudo apt update
sudo apt install yarn

Step 3 – Verify Installation#

To verify the installation check the version by typing:

yarn --version
1.22.4

Use of Yarn#

At this stage, Yarn is installed on your Debian system. Now we will some basic usage of Yarn commands:

Create a new project#

You need to use yarn init command followed by the project name to create a new Yarn project. For example, to create a project with name demo type:

yarn init demo

You will be prompted for few questions. Give answers for it or you can skip by pressing Enter key.

It will create a package.json file which contains all the information which you provided.

For existing project you also can initiate yarn, navigate to directory and run:

yarn init

Adding dependency#

Add a package to your project, use the yarn add command followed by the package name:

yarn add PACKAGE_NAME

The above command will install latest version of the package and update the project’s package.json and yarn.lock files. For a specific version of package specify version as following:

yarn add PACKAGE_NAME@VERSION

Upgrading dependency#

You can update the packages by simple use of following command:

yarn upgrade

It will update all the project dependencies to their latest version. You can specify the package name and version for specific update.

Removing dependency#

To remove a package from the project’s dependencies, use the yarn remove command followed by the package name:

yarn remove PACKAGE_NAME

Installing all project dependencies#

To install all the dependencies of an existing project that are specified in the package.json file run:

yarn install

Conclusion#

You learned how to install Yarn and use of common commands on Debian 10 system. You can learn more about Yarn at documentation page.

If you have any questions or suggestion, leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install MariaDB on Ubuntu 20.04
Next Article   How to Install PHP 7.4 on Ubuntu 20.04

Related Posts

  • How to Install WordPress with Nginx on Debian 11

    How to Install WordPress with Nginx on Debian 11

    March 22, 2023
  • How to Install and Use Docker on Debian 11

    How to Install and Use Docker on Debian 11

    March 10, 2023
  • How to Install MariaDB on Debian 11 Bullseye

    How to Install MariaDB on Debian 11 Bullseye

    March 8, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook