npm vs yarn Cheatsheet

Compares npm and yarn commands. Taken from Infinite Red’s NPM vs YARN Cheatsheet.

npmyarndescription
npm inityarn initCreate a new package.json file
npm installyarnInstall is the default behavior
npm install taco –saveyarn add tacoAdd package to package.json
npm uninstall taco –saveyarn remove tacoRemove package from package.json
npm install taco –save-devyarn add taco –devAdd package to package.json as a dev dependency
npm update –saveyarn upgradeUpgrade to newest versions of packages
npm install taco –globalyarn global add tacoInstall a package globally
npm linkyarn linkLinks a project for local testing
npm outdatedyarn outdatedList the outdated dependencies
npm publishyarn publishPublish a package to a repository
npm runyarn runRun a script from package.json
npm cache cleanyarn cache cleanClean the local cache
npm loginyarn loginlogin to a repository
npm logoutyarn logoutlogout to a repository
np testyarn testrun unit tests
no equivalentyarn why tacoExplain why taco package is installed (transitive dependencies)