Removing unused node modules with yarn

Every now and then I install a node module to test something out. Or haven’t decided which package to use for a certain use-case and install multiple packages that do the same thing.

You can remove those packages from the dependencies section in your package.json, but that doesn’t remove the package from the node_modules folder. Yarn has an autoclean command that removes unnecessary dependencies.

$ yarn autoclean

What about npm?

npm offers a similar command to remove unnecessary dependencies; prune.

$ npm prune

See Also

6 Non-Programming Books for Programmers