Paul
Paul

Reputation: 4436

package.json know if there are any dependencies that are not used

I have on a dependency project, I would like to know which of these dependencies is never used.

Example I have the following dependencies:

 "dependencies": {
    "axios": "^0.19.2",
    "d3": "^5.16.0",
    "d3-scale": "^3.2.2",
    ...
}

Let's say that in my project I have never used the dependency that I had installed the d3, I would like it to be reported to me.

How can I get a list of all dependencies installed but not used?

Upvotes: 0

Views: 136

Answers (1)

Mansur Ali Koroglu
Mansur Ali Koroglu

Reputation: 1918

There is a package for that.

npm install -g depcheck

Run in your project directory

depcheck

See the results

Unused dependencies
* chalk
* express
Unused devDependencies
* nodemon

Upvotes: 1

Related Questions