npm与yarn cli命令比较

从npm迁移的过程应该非常简单。Yarn和npm使用相同的package.json格式,而且Yarn可以从npm安装依赖包。

cli命令比较

npm (v5) Yarn
npm install yarn install
- yarn install –flat
- yarn install –har
npm install –no-package-lock yarn install –no-lockfile
- yarn install –pure-lockfile
npm install [package] yarn add [package]
npm install [package] –save-dev yarn add [package] –dev
- yarn add [package] –peer
npm install [package] –save-optional yarn add [package] –optional
npm install [package] –save-exact yarn add [package] –exact
- yarn add [package] –tilde
npm install [package] –global yarn global add [package]
npm update –global yarn global upgrade
npm rebuild yarn install –force
npm uninstall [package] yarn remove [package]
npm cache clean yarn cache clean [package]
rm -rf node_modules && npm install yarn upgrade

Search

    Table of Contents