yarn命令和npm命令的对应关系

yarn的常用操作:

1.yarn init -y(-y是全部默认)npm init -y

2.下载项目的所有声明的依赖(把package.json里声明的所有包下载)

yarn 或者 npm i

3.下载指定的版本依赖包:

yarn add xxx @ y.y.y(安装xxx包的y.y.y版本)

npm i xxx @ y.y.y

4.全局下载指定包

yarn global add xxx

npm i xxx -g

5.删除包

yarn remove xxx

npm remove xxxx -S(-S或者-D分情况,也可以不写)

yarn global remove xxx

yarn remove xxx -g

6.运行项目中配置的script(package.json中配置的script)

yarn run xxx

npm run xxx

7.查看某个包的信息

yarn info xxx

npm info xxx

8.设置淘宝镜像!!!!!

yarn config set registry https://registry.npm.taobao.org

npm config set registry https://registry.npm.taobao.org

发布了29 篇原创文章 · 获赞 0 · 访问量 178

猜你喜欢

转载自blog.csdn.net/qq_41523392/article/details/103624502
今日推荐