当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- R中按照数字大小进行排序
- 5G-based Warehousing Informatization Solution 2022
- 四大首搭加持,美学、安全、操控、效率优势明显,比亚迪海豹售价20.98万元起售!
- How is the B+ tree index page size determined?
- golang modules初始化项目
- Extremely Knowing v2 Analysis
- Metaverse Post Office AI space-themed series of digital collections will be launched at 10:00 on July 30th "Yuanyou Digital Collection"
- canal scrape data
- tiup list
- 微服务架构下的核心话题 (二):微服务架构的设计原则和核心话题
猜你喜欢

本地事务与分布式事务

Mysql数据库查询好慢,除了索引,还能因为什么?

Local Transactions vs Distributed Transactions

golang modules initialization project

952. 按公因数计算最大组件大小 : 枚举质因数 + 并查集运用题

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

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

(Crypto essential dry goods) Detailed analysis of the current NFT trading markets

GeoServer + openlayers

Our company has used gateway services for 6 years, dynamic routing, authentication, current limiting, etc., a stable batch!
随机推荐
canal scrape data
[Cloud Native] Service Industry Case - Solutions for Unpredictable Concurrency Scenarios
MASM32v11编程调用Process32First失败: 程序发出命令,但命令长度不正确
Lock wait timeout exceeded解决方案
localhost with 127.0.0.1
Store Limit 使用文档
Huawei issues another summoning order for "Genius Boys"!He, who had given up an annual salary of 3.6 million, also made his debut
ISELED---the new choice of ambient lighting scheme
后浪来袭!阿里产出“第二代”容器技术手册及脑图,这也太香了吧
2022最新 | 室外单目深度估计研究综述
golang modules初始化项目
Configuration - Notes
L2-007 家庭房产(vector、set、map的使用)
DDS Arbitrary Waveform Output Based on FPGA
70行代码撸一个桌面自动翻译神器
《二舅》刷屏了!
(科普文)什么是碎片化NFT(Fractional NFT)
使用 TiUP 命令管理组件
Excel uses Visual Basic Editor to modify macros
MySql error: SqlError(Unable to execute query", "Can't create/write to file OS errno 2 - No such file...