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

相关推荐
懂懂tty3 小时前
React状态更新流程
前端·react.js
小码哥_常3 小时前
告别繁琐!手把手教你封装超实用Android原生Adapter基类
前端
skywalk81633 小时前
pytest测试的时候这是什么意思?Migrating <class ‘kotti.resources.File‘>
前端·python
一只蝉nahc4 小时前
vue使用iframe内嵌unity模型,并且向模型传递信息,接受信息
前端·vue.js·unity
子兮曰4 小时前
Bun v1.3.12 深度解析:新特性、性能优化与实战指南
前端·typescript·bun
2401_885885045 小时前
易语言彩信接口怎么调用?E语言Post实现多媒体数据批量下发
前端
a1117765 小时前
Three.js 的前端 WebGL 页面合集(日本 开源项目)
前端·javascript·webgl
Kk.08025 小时前
项目《基于Linux下的mybash命令解释器》(一)
前端·javascript·算法
小李子呢02116 小时前
前端八股---闭包和作用域链
前端
IT_陈寒7 小时前
Redis的内存溢出坑把我整懵了,分享这个血泪教训
前端·人工智能·后端