Codementor Events

Quickly remove all node_modules folders from your system to free up disk space

Published Sep 04, 2021
Quickly remove all node_modules folders from your system to free up disk space

Whenever, we are working with React, Angular, Nodejs or any other library or framework, we always need to create a node_modules folder which takes up a lot of space and we don’t bother to remove the node_modules folder once our job is done.

So we end up creating many node_modules folders in various project folders which takes up a lot of hard-disk space on our filesystem.

Today we will see a very helpful command which scans our file system and easily allows us to remove the node_modules folders in a single click within seconds.

Installation

You actually, don’t need to install the package to use it.

You just need to run it as

npx npkill

npx allows to run npm commands without installing the package.

You can however, install the npkill package if you really need to install it using

npm install npkill -g

and now you can just run npkill command from the terminal from any directory to delete the node_modules folder.

Once the list is displayed, you can navigate using arrow keys and delete the specific node_modules directory by hitting spacebar.

To exit out of the list, press q key on your keyboard or Control + C

By default, npkill will list out the node_modules folders from the current directory and its subdirectories.

So if you want to delete all the node_modules from your system, you need to execute thenpkill command from your home or root directory.

Speed

You might think that it will take a lot of time to delete a single node_modules folder using npkill, but that’s not true. Actually, it's very fast. within a second the folder will be deleted. So Just give it a try.

Thanks for reading!

This was a quick introduction to Redux from my Mastering Redux course.

In the Mastering Redux course, you will learn:

  • Basic and advanced Redux
  • How to manage the complex state of array and objects
  • How to use multiple reducers to manage complex redux state
  • How to debug Redux application
  • How to use Redux in React using react-redux library to make your app reactive.
  • How to use redux-thunk library to handle async API calls and much more

and then finally we'll build a complete food ordering app from scratch with stripe integration for accepting payments and deploy it to the production.

Want to stay up to date with regular content regarding JavaScript, React, Node.js? Follow me on LinkedIn.

Discover and read more posts from Yogesh Chavan
get started
post comments1Reply
Ahmad Wahyudi
a year ago

very helpfull tools, thankyou