当前位置:网站首页>yarn安装详细教程说明、升级教程、修改yarn的全局和缓存目录、yarn基本命令
yarn安装详细教程说明、升级教程、修改yarn的全局和缓存目录、yarn基本命令
2022-07-30 14:55:00 【segegefe】
目录
2、报Error: EPERM: operation not permitted, mkdir错误:
1、直接用npm install yarn -g 来安装:
用管理员身份打开cmd执行:
C:Windowssystem32>npm install yarn -g
> [email protected] preinstall D:Program Files
odejs
ode_global
ode_modulesyarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
D:Program Files
odejs
ode_globalyarn -> D:Program Files
odejs
ode_global
ode_modulesyarninyarn.js
D:Program Files
odejs
ode_globalyarnpkg -> D:Program Files
odejs
ode_global
ode_modulesyarninyarn.js
+ [email protected]
added 1 package in 5.331s
yarn安装成功。
2、报Error: EPERM: operation not permitted, mkdir错误:
如果在npm install时报错 Error: EPERM: operation not permitted, mkdir,就是因为权限问题,需要用管理员身份打开cmd,再执行命令就可以了。
快速打开管理身份cmd的方法:
win+R打开运行窗口,然后输入cmd,别点确定按纽,直接按快捷键Ctrl+Shift+Enter即可打开管理员命令窗口:

3、修改yarn的全局、缓存目录:
以下三个命令分别为:bin是yarn存储命令的二进制文件,global存储全局node_modules ,cache存储用下下载缓存,查看本机目前的目录:
查看bin目录命令:yarn global bin
查看global目录命令:yarn global dir
查看cache目录命令:yarn cache dir
执行效果如下:
C:Windowssystem32>yarn global bin
D:Program Files
odejs
ode_globalin
C:Windowssystem32>yarn global dir
C:UsersAdministratorAppDataLocalYarnDataglobal
C:Windowssystem32>yarn cache dir
C:UsersAdministratorAppDataLocalYarnCache6
修改位置命令:
yarn config set prefix “自定义bin目录路径”
yarn config set global-folder “自定义node_modules目录路径”
yarn config set cache-folder “自定义cache目录路径”
执行效果如下:
C:Windowssystem32>yarn config set global-folder "D:Program Files
odejsyarnglobal"
yarn config v1.22.18
success Set "global-folder" to "D:\Program Files
odejs\yarn\global".
Done in 0.07s.
C:Windowssystem32>yarn config set cache-folder "D:Program Files
odejsyarncache"
yarn config v1.22.18
success Set "cache-folder" to "D:\Program Files
odejs\yarn\cache".
Done in 0.07s.
yarn安装完后需要配置环境变量,配置如下,标记第4点为本机的global目录:

环境变量设置好之后,就可以在任意位置使用命令了:

4、yarn换淘宝源:
默认依赖包源在国外,网络不好时就会慢,可以换成淘宝源。
查看当前源: yarn config get registry
更换源: yarn config set registry https://registry.npm.taobao.org

5、yarn升级:
查询yarn最新版本号,或在yarn有新版本时控制台会提示,使用指定版本号的命令即可升级。
npm install [email protected] -g
6、yarn基本命令
yarn包管理器与npm的类似:

**安装包:**yarn [global] add [package]@[version]
**更新包:**yarn upgrade [package | [email protected] | [email protected] | @scope/]… [–ignore-engines] [–pattern]
**删除包:**yarn remove <package…>
**列出所有包和它们的依赖:**yarn list [–depth] [–pattern]
**运行脚本:**yarn run [script] []
开启yarn之旅吧!
参考:https://www.macs.vip/archives/235
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- 71-page comprehensive overall solution for global tourism 2021 ppt
- Compile, link, notes - 3
- 【云原生 • DevOps】influxDB、cAdvisor、Grafana 工具使用详解
- v-model组件化编程应用
- Delayed message queue
- MASM32v11编程调用Process32First失败: 程序发出命令,但命令长度不正确
- GeoServer
- 【云原生】阿里云ARMS业务实时监控
- Extremely Knowing v2 Analysis
- ISELED---the new choice of ambient lighting scheme
猜你喜欢

481-82(105、24、82、34、153)

About the data synchronization delay of MySQL master-slave replication

【云原生 • DevOps】influxDB、cAdvisor、Grafana 工具使用详解

元宇宙的前景及四大赛道

ISELED---the new choice of ambient lighting scheme

Local Transactions vs Distributed Transactions

(Crypto必备干货)详细分析目前NFT的几大交易市场

后浪来袭!阿里产出“第二代”容器技术手册及脑图,这也太香了吧

Delayed message queue

952. 按公因数计算最大组件大小 : 枚举质因数 + 并查集运用题
随机推荐
canal scrape data
JHM:芳环羟化双加氧酶数据库DARHD建立及相关引物评价
Metaverse Post Office AI space-themed series of digital collections will be launched at 10:00 on July 30th "Yuanyou Digital Collection"
(科普文)什么是碎片化NFT(Fractional NFT)
TiDB 工具下载
Memory-mapped, bit-band operations
瑞吉外卖项目实战Day02
nodejs环境变量设置
TiDB 工具适用场景
Delayed message queue
100w的数据表比1000w的数据表查询更快吗?
MySql error: SqlError(Unable to execute query", "Can't create/write to file OS errno 2 - No such file...
延时消息队列
[Enlightenment by Opportunity-53]: "Sushu"-3- Self-cultivation and Self-cultivation
编译、链接 - 笔记 - 3
JUC common thread pool source learning 02 ( ThreadPoolExecutor thread pool )
Alluxio for Presto fu can across the cloud self-service ability
SQL 优化这么做就对了!
About the data synchronization delay of MySQL master-slave replication
第十一章 api mgmnt API 参考