Free space by deleting node_modules

Node.js
Node.js

Did you know you can free disk space by deleting node_modules?

To check the disk usage of your current working directory:

To find all directories (in your working directory) that matches the name node_modules:

Execute recursive remove on all matches:

Display the disk usage of your current working directory:

Example

Here’s an example of how to delete node_modules of a project bootstrapped by Create React App.

Create app:

Check disk usage:

Delete node_modules:

Check disk usage:

--

--

remarkablemark.org

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store