Find Unused npm Packages in Your Package.json

JavaScript makes it easy to install packages and dependencies into our apps.

The problem is, after a few days, weeks, or months of hacking, how the heck do we know what isn't even being used anymore?

npm find unused npm packages

Find unused packages

It's easy with a neat package called depcheck.

From your terminal, go into the root folder of your project (wherever your package.json lives) and run the following command:

npx depcheck

Now you'll see the output showing two sections, your "unused depencies", and "unused devDependencies".

Results of running npx depcheck

Now, uninstall those suckers!!!

Although it's usually great, I've noticed occasionally depcheck gets it wrong, so make sure you confirm that you aren't using those packages before you drop the dynamite. 💣

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. 🎉

NpmJavaScriptWeb Developer
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.


Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.