To keep your local environment clean, it could be sometimes a good idea to just run:
npm clean-install
and get rid of all those piled up and unused packages you collected.
If you are using a shrinkwrap.json you could also just run
npm ci
and install the dependencies from there.