Yarn 与 npm 命令对比


Yarnnpm
yarn addnpm install
yarn add --flat/
yarn add --har/
yarn add --no-lockfilenpm install --no-package-lock
yarn add --pure-lockfile/
yarn add [package]npm install [package] --save
yarn add [package] --devnpm install [package] --save-dev
yarn add [package] --peer/
yarn add [package] --optionalnpm install [package] --save-optional
yarn add [package] --exactnpm install [package] --save-exact
yarn add [package] --tilde/
yarn global add [package]npm install [package] --global
yarn global upgrade                    npm update --global                  
yarn add --forcenpm rebuild
yarn remove [package]npm uninstall [package]
yarn cache clean [package]npm cache clean
yarn upgrade                          rm -rf node_modules && npm install  
yarn version --major                  npm version major                    
yarn version --minor                  npm version minor                    
yarn version --patch                  npm version patch                    
参考资料 Reference :
CLI commands comparison

back home