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

相关推荐
P7Dreamer1 天前
微信小程序处理Range分片视频播放问题:前端调试全记录
前端·微信小程序
RedHeartWWW1 天前
初识next-auth,和在实际应用中的几个基本场景(本文以v5为例,v4和v5的差别主要是在个别显式配置和api,有兴趣的同学可以看官网教程学习)
前端·next.js
C_心欲无痕1 天前
前端页面中,如何让用户回到上次阅读的位置
前端
C_心欲无痕1 天前
前端本地开发构建和更新的过程
前端
Mintopia1 天前
🌱 一个小而美的核心团队能创造出哪些奇迹?
前端·人工智能·团队管理
蚊道人1 天前
Nuxt 4 学习文档
前端·vue.js
悠哉摸鱼大王1 天前
前端音视频学习(一)- 基本概念
前端
stella·1 天前
后端二进制文件,现代前端如何下载
前端·ajax·状态模式·axios·request·buffer·download
奋斗猿1 天前
Less vs Scss 全解析:从语法到实战的前端样式预处理器指南
前端
Web - Anonymous1 天前
使用Vue3 + Elementplus + Day.js 实现日期选择器(包括日、周、月、年、自定义) - 附完整示例
前端·javascript·vue.js