当前位置:网站首页>NPM ---- 安装yarn
NPM ---- 安装yarn
2022-08-02 05:18:00 【m0_67392931】
NPM ---- 安装yarn
安装
yarn的前提是需要先安装好npm,且环境变量都配置好了,才可以使用。
一、下载安装
npm install yarn -g
安装完成之后检查版本:
yarn --version // 1.22.17
二、配置Yarn
配置源:
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 config get registry // https://registry.npm.taobao.org
yarn config get sass_binary_site // http://cdn.npm.taobao.org/dist/node-sass
三、Yarn的优点
yarn是Facebook发布的一款npm包管理工具,个人感觉使用起来非常舒服:
- 安全
在执行代码之前,Yarn会通过算法校验每个安装包的完整性。 - 速度快
Yarn缓存了每个下载过的包,所以再次使用时无需重复下载。 同时利用并行下载以最大化资源利用率,因此安装速度更快。 - 可靠
由于yarn.lock存在的机制,项目中的依赖的版本会被锁定,不用担心协同开发过程中出现版本不一致的问题。而npm永远都会给你下载最新的依赖版本,非常的狗血。
四、一些常用的Yarn命令
yarn init // 生成package.json文件
yarn install // 安装yarn.lock的所有依赖
yarn install --force // 重新安装依赖
yarn remove moduleName // 删除依赖
yarn add moduleName // 安装某个依赖
yarn add moduleName --dev/-D // 安装到开发环境
yarn run scriptName // 执行package.json命名的脚本命令
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- nacos注册中心
- 卸载redis
- 秒杀系统小demo
- BGP实验(路由反射器,联邦,路由优化)
- Redis集群模式
- Polar Parametrization for Vision-based Surround-View 3D Detection Paper Notes
- 18 years of programmer career, read more than 200 programming books, pick out some essence to share with you
- 51 MCU Peripherals: Infrared Communication
- 目标检测重要概念——IOU、感受野、空洞卷积、mAP
- flex布局(弹性布局)
猜你喜欢
随机推荐
51 MCU peripherals: DS18B20
Introduction to coredns
Features and installation of non-relational database MongoDB
goroutine (coroutine) in go language
JUC(一)- JUC学习概览 - 对JUC有一个整体的认识
Linux CentOS8安装Redis6
【OpenCV从入门到实践】图像处理技术[像素](全网最详细)
Cyber Security Learning - Intranet Penetration 4
Luogu mini game Daquan (everyone who uses Luogu must know)
flex layout (flexible layout)
An advanced method for solving palindromes
Redis database
oracle 远程连接数据库
关于 VS Code 优化启动性能的实践
About the directory structure of the web application
pl/sql之神奇的嵌套与变量生命周期
Home NAS server (4) | MergerFS and SnapRaid data backup
25K test old bird's 6-year experience in interviews, four types of companies, four types of questions...
秒杀系统小demo
Alluxio为Presto赋能跨云的自助服务能力









