Useful Shorthand npm Commands

Hacker beside an npm logo

As professional code hackers, we like to ensure we are typing as little as possible.

Here are some shorthand npm commands that I regularly use that have added YEARS* of productivity to my workflow

*Years might be an exaggeration...

Install a package

Longhand 🚫

npm install my-package-name

Shorthand 👇

npm i my-package-name

Install a dev dependency

Longhand 🚫

npm install --save-dev my-package-name

Shorthand 👇

npm i -D my-package-name

Install a global dependency

Longhand 🚫

npm install --global my-package-name

Shorthand 👇

npm i -g my-package-name

Update a package

Longhand 🚫

npm update my-package-name

Shorthand 👇

npm up my-package-name

Uninstall a package

Longhand 🚫

npm uninstall my-package-name

Shorthand 👇

npm un my-package-name

Create default package.json

Longhand 🚫

npm init --yes

Shorthand 👇

npm init -y

Let me know in the comments below what you will do with all your newly earned free time. 😉 💬


Follow me on Twitter or connect on LinkedIn.

🚨 Want to make friends and learn from peers? You can join our free web developer community here. 🎉

NpmJavaScriptNodejs
Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses: Lead Developer, Software Architect, Product Manager, CTO, and now happily a Founder.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.