Remove all unused dependencies from npm packages.json

npm, npm-install, reactjs

Solution

You can try the `depcheck` which meet your requirement: https://www.npmjs.com/package/depcheck

Problem

I inherited a react project that has a packages.json file with a ton of dependencies, many of which aren't even in the project. Is there some good tool or method for cleaning up packages.json, basically removing all the packages that are unused while keeping all that are needed? Right now I have to go line by line, remove a package, and then test the project & builds - and hope I didn't miss something, which seems very error prone.

Original source