怎么下载安装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 包名称
相关推荐
Luna-player18 小时前
npm install vue-awesome-swiper@5.0.1 swiper@7.4.1安装后,我又想全删了,怎么移除
前端·vue.js·npm
军哥全栈AI3 天前
Windows11 彻底卸载Node.js(无残留,适配所有版本)
npm·node.js
❀͜͡傀儡师4 天前
通过npm 手动安装、Docker 部署 OpenClaw小龙虾
前端·docker·npm
头发多多程序媛4 天前
解决依赖下载报错,npm ERR! code EPERM
前端·npm·node.js
console.log('npc')4 天前
pnpm使用
前端·npm
VillenK6 天前
@vue-office依赖报错
前端·npm
虚拟世界AI6 天前
Vue.js安装指南:快速搭建开发环境
vue.js·npm·node.js
ruanCat6 天前
pnpm 踩坑实录:用 public-hoist-pattern 拯救被严格隔离坑掉的依赖
前端·npm·node.js
无责任此方_修行中6 天前
一个 GitHub Issue 标题如何让 4000 台电脑沦陷?
后端·npm·ai编程
多加点辣也没关系6 天前
Node.js 与 npm 的安装与配置(详细教程)
前端·npm·node.js