In this article, we will have explained the necessary steps to install Yarn on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Yarn is a java script package manager that enables you to use and share your code with other developers quickly, securely, and reliably through a package which contains all the code being shared as well as a package.json file which describes the package.
Install Yarn on Debian
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade
Step 2. Install Yarn.
Now add the Yarn APT repository to your system:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
Importing key add Yarn APT repository using the following command:
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Run the command below to install it:
sudo apt update sudo apt install yarn
To verify that Yarn installed successfully, run the following commands which will print the Yarn version number:
Step 3. Using Yarn.
Create a new Project:
sudo yarn init new_project
The init script will ask you several questions. You can either answer or press enter to use the default values:
yarn init v1.17.3 question name (vagrant): linuxtips question version (1.0.0): 0.0.1 question description: Testing Yarn question entry point (index.js): question repository url: question author: Linuxize question license (MIT): question private: success Saved package.json Done in 16.18s.
To install all the dependencies given inside package.json file use following command:
Following is the basic syntax for adding the dependency:
yarn add [package_name]
Congratulation, you have learned how to install and configure Yarn on Debian 10 Buster. If you have any question, please leave a comment below.