YARN and NPM (Node Package Manager) are the two popular JavaScript package managers to automate the process of installing, updating and removing NPM packages. In this guide, we will learn how to install YARN on the Ubuntu system. We will also look into some of the commonly used YARN commands.
YARN和NPM(节点程序包管理器)是两个流行JavaScript程序包管理器,可自动执行安装,更新和删除NPM程序包的过程。 在本指南中,我们将学习如何在Ubuntu系统上安装YARN。 我们还将研究一些常用的YARN命令。
纱线vs NPM (YARN vs NPM)
NPM has few drawbacks like network connectivity issues, slow installation process to mention few and YARN was developed by Facebook to resolve those shortcomings.
NPM几乎没有缺点,例如网络连接问题,缓慢的安装过程(很少提及),而YARN由Facebook开发来解决这些缺点。
YARN is not a replacement for NPM but in fact, it uses the same modules from NPM registry but with the different installation method. Since Yarn doesn’t require you to make any changes to the current workflow, it is possible to install YARN and use it at any point of time during your projects development phase.
YARN不能替代NPM,但实际上,它使用NPM注册表中的相同模块,但安装方法不同。 由于Yarn不需要您对当前工作流程进行任何更改,因此可以在项目开发阶段的任何时间点安装YARN并使用它。
Let’s get started with the installation of Yarn in an Ubuntu 18.04 system via the official Yarn APT package repository.
让我们开始通过正式的Yarn APT软件包存储库在Ubuntu 18.04系统中安装Yarn。
先决条件 (Prerequisites)
- You can open a SSH session in your Ubuntu 18.04 system using
root
or asudo
enabled user. 您可以使用root
或启用sudo
用户在Ubuntu 18.04系统中打开SSH会话。