Skip to content

Instantly share code, notes, and snippets.

@Aetherinox
Created March 15, 2024 06:47
Show Gist options
  • Save Aetherinox/609669eef37e08afb7d8f3c2f4a5acf2 to your computer and use it in GitHub Desktop.
Save Aetherinox/609669eef37e08afb7d8f3c2f4a5acf2 to your computer and use it in GitHub Desktop.
NPM - Yarn Commands.md

Comparing npm and Yarn Commands

Install dependencies

npm install => yarn 

Install a package

npm install [package_name] => yarn add [package_name]

Install a package globally

npm install -g [package_name] => yarn global add [package_name]

Install a package as a development dependency

npm install --save-dev [package_name] => yarn add --dev [package_name]

Uninstall a package

npm uninstall [package_name] => yarn remove [package_name]

Uninstall a package globally

npm uninstall -g [package_name] => yarn global remove [package_name]

Uninstall a development dependency package

npm uninstall --save-dev [package_name] => yarn remove [package_name]

Update the dependencies

npm update => yarn upgrade 

Update a package

npm update [package_name] => yarn upgrade [package_name]

Create a new package

npm init => yarn init

Run a script defined in the package.json

npm run => yarn run

Test a package

npm test => yarn test

Publish a package

npm publish => yarn publish

Remove all data from the cache

npm cache clean => yarn cache clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment