How to Install Yarn on Debian 9
Table of Contents
Install Yarn on Debian
Before you start to install Yarn on Debian 9. You must have the non-root user account on your system with sudo privileges.
Install Yarn on Debian
First you will need to add Yarn APT repository to your system. Then you will install Yarn on Debian.
Now import Yarn repositories GPG key using following command to enable the Yarn repository using following curl command:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
After importing key add Yarn APT repository using following command:
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Update APT package manager index and install Yarn using following commands. Following command will also install Node.js when installing Yarn.
sudo apt update
sudo apt install yarn
If you don’t want to install Node.js automatically with Yarn then use following command:
sudo apt install --no-install-recommends yarn
Now confirm installation and check version of Yarn using following command:
The output should look like:
Eaxamples of Using Yarn
Create a new Project
You can create new project using Yarn running following command. This command will also ask you some questions please press
to use default values or type answer.
sudo yarn init new_project
NOTE: Now it will create
package.json file saving information provided by you. You can also edit the information inside file anytime.
The above command output should look like:
yarn init v1.13.0 question name (vagrant): Linux4one question version (1.0.0): 0.0.1 question description: Testing Yarn question entry point (index.js): question repository url: question author: Linux4one question license (MIT): question private: success Saved package.json Done in 17.56s.
Install all dependencies
To install all the dependencies given inside
package.json file use following command
The above command will install all the dependencies given in
Following is the basic syntax for adding dependency:
yarn add [package_name]
yarn add [package_name]@[version_number_or_tag_name]
The above command will add dependency to your project updating
The basic syntax for removing dependency is given below:
yarn remove [package_name]
The above command removes specific dependency from your project updating
The basic syntax for upgrading dependency is given below:
yarn upgrade [package_name]
yarn upgrade [package_name]@[version_number_or_tag_name]
The above command will upgrade specific package to latest version in your project then updates
You have successfully learned how to install Yarn on Debian 9. If you have any queries regarding this then please dont forget to comment below.
How to Add Swap Space on CentOS 8
How to install Dropbox on Debian 9 Server and Desktop
How to Install Yarn on CentOS 7
How to Install Google Earth on Linux Mint 19
How to Install Opera Browser on Debian 9
How to Install IntelliJ IDEA IDE on Debian 10
How to install Node.js with npm on Debian 9
How to Install Skype on Fedora 29
How to Install Apache on Debian 10
How to Install PostgreSQL on Linux Mint 19
How to Install MySQL on Debian 10
Copy Files using cp command in Linux