Skip to content

Remove unused npm modules from package.json

Depcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and which dependencies are unused from package.json.

To identify the unused package, just run npx depcheck in the project root directory

> npx depcheck


npx: installed 146 in 88.761s
Unused dependencies
* express-validator
Advertisements

Next step is to uninstall the npm packages using npm uninstall command.

> npm uninstall express-validator
npm WARN retina-backend@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

removed 2 packages and audited 626 packages in 12.337s

24 packages are looking for funding
  run `npm fund` for details

found 24150 vulnerabilities (24147 low, 3 high)
  run `npm audit fix` to fix them, or `npm audit` for details
See also  Add Swagger documentation to your Express APIs

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.