Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the advantages of Yarn

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the advantages of Yarn". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's ideas to study and learn "what are the advantages of Yarn"?

Yarn is a fast, reliable and secure dependency management tool. Compared with npm, yarn has many advantages, the main advantages are: high speed, offline mode, version control.

Advantages of yarn

1. High speed

Npm waits for one package to be fully installed before skipping to the next, but yarn executes the package in parallel, so it's much faster. On the Internet, there are a lot of npm and yarn installation rely as much on the execution speed, yarn has obvious advantages in terms of speed. Experience the same flying speed in the actual project, who knows who has tried it?

2. Offline mode

The principle of offline is relatively simple, the installed package will be saved in the cache directory, and then the installation will be copied directly from the cache. The essence of doing so will still improve the speed of installation and download and avoid unnecessary network requests.

3. Version control

One of the stronger pain points of npm is that version control is not accurate enough when the dependency level of the package is deep. Yarn is inherently version-hardened. A npm-shrinkwrap.json-like yarn.lock file is generated that describes the version number of the package itself and locks the version numbers of all packages it depends on.

Installation of yarn

1. Install Chocolatey. After installing Chocolatey, you can install Yarn with the following instructions:

Chocoinstallyarn

The installation method also requires that you install Node.js in advance.

Yarn usage

Initialize a new project

Yarninit

Add a dependency package

Yarnadd [package]

Yarnadd [package] @ [version]

Yarnadd [package] @ [tag]

Update a dependency package

Yarnupgrade [package]

Yarnupgrade [package] @ [version]

Yarnupgrade [package] @ [tag]

Delete a dependency package

Yarnremove [package]

Install all dependent packages

Yarn

Or

Yarninstall

Thank you for your reading, the above is the content of "what are the advantages of Yarn". After the study of this article, I believe you have a deeper understanding of what the advantages of Yarn are, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

  • How to realize the interchange between left and right menus in html

    This article will explain in detail how html can interchange left and right menus. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report