yarn的用法

安装 

npm install -g yarn

使用npm全局安装或者也可以使用官网的安装方法 

安装原文地址:yarn官网


开始一个新项目

yarn init

添加一个依赖项

yarn add [package]
yarn add [package]@[version]
yarn add [package]@[tag]

将依赖关系添加到不同类别的依赖项

添加到devDependenciespeerDependenciesoptionalDependencies分别为:

yarn add [package] --dev
yarn add [package] --peer
yarn add [package] --optional

升级依赖项

yarn upgrade [package]
yarn upgrade [package]@[version]
yarn upgrade [package]@[tag]

删除依赖项

yarn remove [package]

安装项目的所有依赖项

yarn

要么

yarn install

npm 与 yarn 命令对比

npm yarn
npm install yarn install
(N/A) yarn install --flat
(N/A) yarn install --har
(N/A) yarn install --no-lockfile
(N/A) yarn install --pure-lockfile
npm install [package] (N/A)
npm install --save [package] yarn add [package]
npm install --save-dev [package] yarn add [package] [--dev/-D]
(N/A) yarn add [package] [--peer/-P]
npm install --save-optional [package] yarn add [package] [--optional/-O]
npm install --save-exact [package] yarn add [package] [--exact/-E]
(N/A) yarn add [package] [--tilde/-T]
npm install --global [package] yarn global add [package]
npm rebuild yarn install --force
npm uninstall [package] (N/A)
npm uninstall --save [package] yarn remove [package]
npm uninstall --save-dev [package] yarn remove [package]
npm uninstall --save-optional [package] yarn remove [package]
npm cache clean yarn cache clean
rm -rf node_modules && npm install yarn upgrade


yarn用法原文地址:yarn官网

yarn与npm命令对比:yarn与npm命令对比

希望我的入坑经验对你有所帮助,愿圣光与你同在



你可能感兴趣的:(学习笔记)