yarn命令和npm命令
Here’s a cheat sheet you can use as a handy reference for npm & Yarn.
这是一份备忘单,您可以将其用作npm& Yarn的方便参考。
There’s a lot of similarities between npm and Yarn. As the newer technology Yarn (released 2016) drew a lot of inspiration from npm (2010).
npm和Yarn之间有很多相似之处。 随着新技术Yarn (2016年发布)从npm (2010)中汲取了很多灵感。
On the flip-side, their similarities can lead to confusion and silly mistakes if you find yourself using both package managers. Hopefully this cheat sheet will serve as a handy reference! 🐊
另一方面,如果您发现自己同时使用了两个程序包管理器,则它们的相似性可能导致混乱和愚蠢的错误。 希望本备忘单可以为您提供方便的参考! 🐊
npm vs纱 (npm vs Yarn)
Command | npm | yarn |
---|---|---|
Install dependencies | npm install | yarn |
Install package | npm install [package] | yarn add [package] |
Install dev package | npm install --save-dev [package] | yarn add --dev [package] |
Uninstall package | npm uninstall [package] | yarn remove [package] |
Uninstall dev package | npm uninstall --save-dev [package] | yarn remove [package] |
Update | npm update | yarn upgrade |
Update package | npm update [package] | yarn upgrade [package] |
Global install package | npm install --global [package] | yarn global add [package] |
Global uninstall package | npm uninstall --global [package] | yarn global remove [package] |
命令 | npm | 纱 |
---|---|---|
安装依赖 | npm install | yarn |
安装套件 | npm install [package] | yarn add [package] |
安装开发包 | npm install --save-dev [package] | yarn add --dev [package] |
卸载程序包 | npm uninstall [package] | yarn remove [package] |
卸载开发包 | npm uninstall --save-dev [package] | yarn remove [package] |
更新资料 | npm update | yarn upgrade |
更新包 | npm update [package] | yarn upgrade [package] |
全局安装包 | npm install --global [package] | yarn global add [package] |
全局卸载软件包 | npm uninstall --global [package] | yarn global remove [package] |
不变的事情 (Things that Haven’t Changed)
There are some commands that Yarn decided not to change. Here’s a quick breakdown:
Yarn决定不更改某些命令。 快速细分:
npm | yarn |
---|---|
npm init | yarn init |
npm run | yarn run |
npm test | yarn test |
npm login (and logout ) | yarn login (and logout ) |
npm link | yarn link |
npm publish | yarn publish |
npm cache clean | yarn cache clean |
npm | 纱 |
---|---|
npm init | yarn init |
npm run | yarn run |
npm test | yarn test |
npm login (和logout ) | yarn login (和logout ) |
npm link | yarn link |
npm publish | yarn publish |
npm cache clean | yarn cache clean |
翻译自: https://www.digitalocean.com/community/tutorials/nodejs-npm-yarn-cheatsheet
yarn命令和npm命令