command cheatsheet: crosswalk from npm to yarn

2020-03-27

 | 

~2 min read

 | 

360 words

I’ve been playing around more with yarn lately and find myself frequently looking up the equivalent command to npm.

Below is a table I’ve compiled from (with the help of the Yarn docs and this cheatsheet by Shift Infinite Red, among others):

npm (v5) Yarn
npm init yarn init
npm link yarn link
npm outdated yarn outdated
npm publish yarn publish
npm run yarn run
npm cache clean yarn cache clean
npm login yarn login (and logout)
npm test yarn test
npm install --production yarn --production
npm install yarn add
(N/A) yarn add --flat
(N/A) yarn add --har
npm install --no-package-lock yarn add --no-lockfile
(N/A) yarn add --pure-lockfile
npm install [package] --save yarn add [package]
npm install [package] --save-dev yarn add [package] --dev
(N/A) yarn add [package] --peer
npm install [package] --save-optional yarn add [package] --optional
npm install [package] --save-exact yarn add [package] --exact
(N/A) yarn add [package] --tilde
npm install [package] --global yarn global add [package]
npm update --global yarn global upgrade
npm rebuild yarn add --force
npm uninstall [package] yarn remove [package]
npm cache clean yarn cache clean [package]
rm -rf node_modules && npm install yarn upgrade
(N/A) yarn upgrade-interactive
npm version major yarn version --major
npm version minor yarn version --minor
npm version patch yarn version --patch
(N/A) yarn licenses ls
(N/A) yarn licenses generate-disclaimer
(N/A) yarn why [package]
npm search [package] (N/A)1

Footnotes


Related Posts
  • 2021 Daily Journal


  • Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!