Find unused packages in node.js
node.js

Find unused packages in node.js

Marcell Simon
Marcell Simon

You can check each dependency one by one to see if you use it somewhere in your project but fortunately someone already wrote a script for that.

Install the depcheck module:

npm install depcheck -g

or

yarn global add depcheck

Run it inside your project's folder to find the unused dependencies:

depcheck

To run without installing the package use npx:

npx depcheck
WARNING! Some dependencies are listed by this package, even if it's used.

Some packages are not imported directly in your project, so don't delete every package without checking what it's used for. A lot of false alarms like this have been fixed by them, like webpack and react related packages, but it still can happen. If you find false alarms, you can create a ticket for them.

If you have a package.json inside a subfolder, it won't check the dependencies of that, as it's considered another project.



Join the conversation.