yarn的使用方法

Installation

MacOS

brew install yarn

Upgrade

MacOS

brew upgrade yarn

yarn --version

Usage

Starting a new project

yarn init

Adding a dependency

yarn add [package]

yarn add [package]@[version]

yarn add [package]@[tag]

Adding a dependency to different categories of dependencies

yarn add [package] --dev

yarn add [package] --peer

yarn add [package] --optional

Upgrading a dependency

yarn upgrade [package]

yarn upgrade [package]@[version]

yarn upgrade [package]@[tag]

Removing a dependency

yarn remove [package]

Installing all the dependencies of project

yarn or yarn install

Migrating from npm

If you want to try Yarn out on your existing npm project, just try running:

yarn

This will lay out your node_modules folder using Yarn's resolution algorithm that is compatible with the node.js module resolution algorithm.

Later, if you decide that Yarn is not for you, you can just go back to using npm without making any particular changes. You can delete your old yarn.lock file if nobody on the project is using Yarn any more but it's not necessary.

Reference:

https://yarnpkg.com/en/docs/getting-started

相关推荐
cs_dn_Jie17 分钟前
钉钉 H5 微应用 手机端调试
前端·javascript·vue.js·vue·钉钉
开心工作室_kaic1 小时前
ssm068海鲜自助餐厅系统+vue(论文+源码)_kaic
前端·javascript·vue.js
有梦想的刺儿1 小时前
webWorker基本用法
前端·javascript·vue.js
cy玩具2 小时前
点击评论详情,跳到评论页面,携带对象参数写法:
前端
qq_390161772 小时前
防抖函数--应用场景及示例
前端·javascript
John.liu_Test3 小时前
js下载excel示例demo
前端·javascript·excel
Yaml43 小时前
智能化健身房管理:Spring Boot与Vue的创新解决方案
前端·spring boot·后端·mysql·vue·健身房管理
PleaSure乐事3 小时前
【React.js】AntDesignPro左侧菜单栏栏目名称不显示的解决方案
前端·javascript·react.js·前端框架·webstorm·antdesignpro
哟哟耶耶3 小时前
js-将JavaScript对象或值转换为JSON字符串 JSON.stringify(this.SelectDataListCourse)
前端·javascript·json
getaxiosluo3 小时前
react jsx基本语法,脚手架,父子传参,refs等详解
前端·vue.js·react.js·前端框架·hook·jsx