Assume I install project packages with npm install that looks into package.json for modules to be installed. After a while I see that I don\'t need
npm install
package.json
Have you tried npm prune?
it should uninstall everything not listed in your package file
https://npmjs.org/doc/cli/npm-prune.html