We all know and use npm start , npm audit , npm init and many more npm commands on a daily basis, but there are quite a few of them that are underutilized ! This article is here to show you some awesome things you can do with the npm CLI.

npm pack

Create a tarball from a package

If you're developing an npm package and want to test if it installs without publishing, running npm pack will package your module into a tgz file that can be installed using npm install .

📄 Docs

npm outdated

Checks for outdates packages

Pretty self-explanatory, it checks the registry if any of the currently installed packages are outdated.

📄 Docs

npm prune

Remove extraneous packages

Removes packages that are not listed on the parent package's dependencies list.

📄 Docs

npm star <pkg>

Mark your favorite packages

Allows you to show some love for a given package.



npm stars lists your currently starred packages.

📄 Docs

npm view <name> <field>

View registry info

You may also add any field that can be found in a package.json such as dependencies to view the related information.

📄 Docs

npm docs <pkg>

Docs for a package in a web browser

How many times did you end up looking for a package's documentation manually? Running npm docs <pkg> will automatically open the relevant page for you (only if it is listed in the package's package.json file).

📄 Docs

npm dedupe

Reduce duplication

Dedupe searches the local package tree and tries to simplify its structure by moving dependencies further up the tree. This way, they can be shared more effectively by multiple dependent packages.

📄 Docs

npm completion

Tab Completion for npm

Running npm completion will display a bash script that will take care of auto-completion of any future npm command. All you have to do is follow the instructions given by the command.



In my case, npm completion >> ~/.bashrc was enough for me to take advantage of that feature !

📄 Docs

And that's enough for one day !

Some of these commands are really, really useful in my opinion so I hope you've enjoyed this article.



If you did, following me on Twitter @christo_kade is probably the best way of showing your support. I post a lot about some cool open-source things I find, JS & CSS tricks and much more.

Thank you for reading !