当前位置:网站首页>Yarn quick reference manual
Yarn quick reference manual
2022-07-25 10:09:00 【A cabbage~】
Take a brief note of yarn Some of the content of
yarn sketch
Apache Hadoop YARN (Yet Another Resource Negotiator, Yet Another Resource Negotiator ) It's a new one Hadoop Explorer , It is a general resource management system , It can provide unified resource management and scheduling for upper applications , It's introduced as a cluster in utilization 、 Unified resource management and data sharing have brought great benefits .
yarn yes facebook It's a replacement for npm Package management tools .
yarn– characteristic
- Fast :Yarn Cache every downloaded package , So you don't have to download it again when you use it again . At the same time, parallel downloads are used to maximize resource utilization , Therefore, the installation is fast .
- Safe and reliable : Before executing the code ,Yarn The integrity of each installation package will be checked by algorithm .yarn Use details 、 Simple lock file format and clear installation algorithm ,Yarn It can ensure that there is no difference in working on different systems .
yarn– install
- Downloaded nodejs And then use npm Installation :
npm install -g yarn yarn --version // View version - download node.js Then download yarn Installation procedure — Provide a .msi File to boot the installation at run time Yarn
- Yarn Taobao source installation , Copy and paste the following code to the black window to run :
yarn config set registry https://registry.npm.taobao.org -g yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
Yarn– Common commands
- Initialize project :
yarn init // Same as npm init, It will be generated after execution package.json file - Configuration item :
yarn config list // Show all configuration items yarn config get <key> // Display a configuration item yarn config delete <key> // Delete a configuration item yarn config set <key> <value> [-g|--global] // Setting configuration items - Installation package :
yarn install // install package.json All the bags in the bag , And save the package, that is, all its dependencies, into yarn.lock yarn install --flat // Install a single version of a package yarn install --force // Force all packages to be downloaded again yarn install --production // Install only dependencies Bag in yarn install --no-lockfile // Do not read or generate yarn.lock yarn install --pure-lockfile // No generation yarn.lock - Add package ( Will update package.json and yarn.lock):
yarn add [package] // Add a dependency package to the current project , Will automatically update to package.json and yarn.lock In file yarn add [package]@[version] // Install the specified version , This refers to the main version , If you need to be accurate to a small version , Use -E Parameters yarn add [package]@[tag] // Install a tag ( such as beta,next perhaps latest) - Do not specify a dependency type. Install to by default dependencies in , You can specify the dependency type :
yarn add --dev/-D // Add to devDependencies yarn add --peer/-P // Add to peerDependencies yarn add --optional /-O // Add to optionalDependencies - The latest version of the main version of the default installation package , The following two commands can specify the version :
yarn add --exact /-E // Exact version of the installation package . for example : yarn add [email protected] Will accept 1.9.1 edition , however yarn add [email protected] --exact Direct said 1.2.3 edition yarn add --title /-T // The latest version of the minor version of the installation package . for example :yarn add [email protected] --title Will accept 1.2.9, But don't accept 1.3.0 - Release package :
yarn publish - Delete package :
yarn remove [packageName] // Remove a package , It will update automatically package.json and yarn.lock - Update dependency :
yarn upgrade // Used to update the package to the latest version of the basic specification - function :
yarn run // Used to perform the package.json in scripts Property - Show package information :
yarn info <packageName> // It can be used to view the latest version information of a module - cache :
yarn cache list // List each package that has been cached yarn cache dir // return Global cache location yarn cache clean // Clear cache
npm And yarn Command comparison :
| npm | yarn | Command specification |
|---|---|---|
| npm init | yarn init | Initialize project |
| npm install/link | yarn install/link | The default installation depends on the operation |
| npm install xxx --save | yarn add xxx | Install a dependency , And saved to by default package |
| npm uninstall xxx --save | yarn remove xxx | Remove a dependency |
| npm install xxx --save-dev | yarn add xxx --dev | Installing a development time dependent project |
| npm update xxx --save | yarn upgrade xxx | Update a dependent project |
| npm install xxx --global | yarn global add xxx | Install a global dependency project |
| npm publish/login/logout | yarn publish/login/logout | Release / Sign in / Log out , A series of NPM Registry operation |
| npm run/test | yarn run/test | Run a command |
npm And yarn Related issues are relatively :
Module dependency history dependency
For example, your project module depends on :@1.2.1 Represents the version of this module . Before you install A You need to install dependency C and D, Many dependencies do not specify a version number , The latest version will be installed by default , In this way, problems will appear : For example, when installing modules today C and D It's a version , And then C、D When it's updated , Installing the module again will install C and D Latest version . If the new version is not compatible with your project , Your program may go wrong BUG, Can't even run . This is it. npm disadvantages , and yarn In order to solve this problem yarn.lock The mechanism of .
yarn Version upgrade and downgrade commands
yarn Upgrade to the latest version
npm install [email protected] -g
see yarn Version history
npm view yarn versions --json
yarn Upgrade the specified version ( example : Upgrade to 1.22.1 edition )
yarn upgrade v1.22.1
yarn Reduce to the specified version ( To uninstall first , Install again )
npm uninstall yarn -g
npm install -g [email protected]1.3.2
If yarn install In case of error . Repeatable install Or remove Re execution .
yarn install --force
yarn cache clean
边栏推荐
- VS无线振弦采集仪蓝牙功能的使用
- Connection and data reading of hand-held vibrating wire vh501tc collector sensor
- SD/SDIO/EMMC
- ARM GIC简介
- Download and installation of QT 6.2
- testbench简介
- Eco introduction
- CCF 201503-3 Festival
- Data viewing and parameter modification of multi-channel vibrating wire, temperature and analog sensing signal acquisition instrument
- CCF 201512-4 delivery
猜你喜欢
![[nearly 10000 words dry goods] don't let your resume don't match your talent -- teach you to make the most suitable resume by hand](/img/2d/e3a326175f04826b9d9c96baedc3a5.png)
[nearly 10000 words dry goods] don't let your resume don't match your talent -- teach you to make the most suitable resume by hand

车辆属性最近一次入库时间初始化生成sql脚本文件

Connection and data reading of hand-held vibrating wire vh501tc collector sensor

小程序分享功能

Subtotal of rospy odometry sinkhole

TM1638 LED数码显示模块ARDUINO驱动代码

Mlx90640 infrared thermal imager temperature measurement module development notes (4)

ESP32连接阿里云MQTT物联网平台

SOC芯片内部结构

Mlx90640 infrared thermal imaging sensor temperature measurement module development notes (II)
随机推荐
Mlx90640 infrared thermal imager temperature measurement module development notes (I)
阿里MQTT物联网平台“云产品流转”实战——两片ESP32通过物联网平台实现远程互操作
用Arduino写个ESP32看门狗
CCF 201503-3 Festival
无线振弦采集仪参数配置工具的设置
@5-1 CCF 2019-12-1 reporting
ROS distributed operation -- launch file starts nodes on multiple machines
用ESP32+TM1638实验NTP网络校时闹钟的ARDUINO代码
Advanced introduction to digital IC Design SOC
Probability theory and mathematical statistics 4 continuous random variables and probability distributions (Part 1)
GCD详解
关闭brew执行命令时的自动更新
工程监测多通道振弦传感器无线采集仪外接数字传感器过程
ADC介绍
vant问题记录
Excel导入导出源码分析
Swift creates weather app
Verdi 基础介绍
mysql历史数据补充新数据
VS无线振弦采集仪蓝牙功能的使用