怎么下载安装yarn

安装

复制代码
npm install --global yarn   

是否安装成功

复制代码
yarn -v         

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 add 包名称@版本号

例:

复制代码
npm 版:npm install --save element-ui@2.15.8

yarn 版:yarn add element-ui@2.15.8

删除依赖

复制代码
npm 版:npm uninstall 包名称

yarn 版:yarn remove 包名称

例:删除 element-ui 依赖

复制代码
npm 版:npm uninstall element-ui

yarn 版:yarn remove element-ui

删除之后在 package.json 中就没有:"element-ui": "^2.15.8" 了

本地安装(将依赖下载到当前命令行所在目录项目中)

复制代码
npm 版:npm install 包名称

yarn 版:yarn add 包名称

全局安装(依赖将被下载安装到【全局目录】中,再创建新项目安装依赖时会自动安装该依赖)

复制代码
npm 版:npm install 包名称 --global // 简写:npm install 包名称 -g

yarn 版:yarn global add 包名称
相关推荐
李永吉3 小时前
一款便捷的npm源管理工具nrm
前端·npm·node.js
鹿衔`1 天前
PySpark 提交模式对比与实践推荐
前端·npm·node.js
Bigger1 天前
构建 “按版本触发、自动发布、自动回写” 的前端组件发布流水线
前端·ci/cd·npm
Rysxt_1 天前
npm与Node.js关系详解及使用教程
前端·npm·node.js
好奇的菜鸟1 天前
前端开发必备:npm配置国内镜像
前端·npm·node.js
寒水馨1 天前
Windows 11 安装使用 nvm,Node.js、npm多版本管理、切换
npm·node.js·windows 11·前端开发·nvm·nvm-windows·多版本管理
9.155261 天前
HBuilder X 掌上商城分类页面模板下载“npm install better-scroll”报错解决办法
前端·npm·node.js
普通网友1 天前
npm发布报错急救手册:快速解决2FA与令牌问题
前端·javascript·学习·面试·npm·node.js
G018_star sky♬1 天前
在vscode的终端上运行vue -V,会出现 : 无法加载文件 C:\Users\31772\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。
vue.js·vscode·npm
汪子熙1 天前
npm 安装报错 Unable to authenticate, need: BASIC realm=Sonatype Nexus Repository Manager`` 的成因、定位与修复全指南
前端·npm·node.js