How to install Yarn on Debian 10
Install Yarn on Debian
Before starting the installation of Yarn on Debian 10, the system must have a non-root user account with sudo privileges.
Install Yarn on Debian
First, you need to add the Yarn APT repository to your system. Next, install Yarn on Debian.
Import the Yarn repository GPG key using the following command and enable the Yarn repository using the following curl command:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
After importing the key, add the 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
Update the APT package manager index and install Yarn using the following command: The following command will also install Node.js when installing Yarn.
sudo apt update
sudo apt install yarn
If you don’t want Yarn to automatically install Node.js, use the following command:
sudo apt install --no-install-recommends yarn
Verify the installation and verify the version of Yarn using the following command:
The output looks like this:
Example of using thread
Create a new project
You can create a new project using Yarn, which runs the following command: This command asks some questions
ENTER to use default values or type answer.
sudo yarn init new_project
Note: this will create
package.json File storage information provided. You can edit the information in the file at any time.
The output of the above command is as follows:
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 dependencies specified internally
package.json A file that uses the following command
The above command will install all specified dependencies
The basic syntax for adding a dependency is as follows:
yarn add [package_name]
yarn add [package_name]@[version_number_or_tag_name]
The above command will add a dependency to the project update
The basic syntax for removing dependencies is as follows:
yarn remove [package_name]
The above command removes certain dependencies from project updates
The basic syntax for upgrading dependencies is as follows:
yarn upgrade [package_name]
yarn upgrade [package_name]@[version_number_or_tag_name]
The above command will upgrade certain packages to the latest version of the project and then update
You learned how to install Yarn on Debian 10. If you have any questions about this, don’t forget the comments below.