npm packages Uncategorized

Delete Node Modules Like a PRO

You might have heard the joke that node_modules is the heaviest object in the universe.

So node modules are good or bad, I do not know maybe it’s bad if it’s so much hated (jk) , one of the reasons it’s hated is that it takes too much space and it takes too much time to delete, but luckily we are saved by these tricks which helps us to delete node modules in no time.

Method 1: rmdir

The rmdir command is used to remove a directory, and thus we can use it our benifit while deleting node_modules.

It deletes the whole folder in just a blink fo eye, to delete node_modules navigate to your project directory and run the follwing comand.

rmdir /s /q node_modules

In this command /s is used to delete all subfolder and files including the node_modules folder itself and /q stands for quite means no futher prompts will be given before deleting everything, Without the /q flag, the command might prompt the user for confirmation before proceeding with the deletion.

Method 2: VS code delete button

This method is for Visual Studio Code users other editors might also have similar feture.

The delete button is very efficient if you are using VS Code, its even faster and convinient than rmdir

To delete the node modules just select node_modules folder and press delete key or right click on the node_modules and click on the delete button.

Method 3: NPKILL

NPKILL is a commandline tool which scans the whole drive and show the size and age of the node_modules folders along with full path the node_modules folder is located in, it gives very siple interface to delete node modules.

To use NPKILL you can install if using npm i -g npkill, open a terminal/ command prompt in the drive that holds your most of the npm projects and run npkill.

Other way is to simply run npx npkill from the terminal and if you are using it for the first time it will ask you to install the npkill for that you just have to press ENTER.

Use UP🔼 and DOWN🔽 arrow key to navigage to the directories list and use SPACEBAR to delete the node_modules folder in current highlighted directory.

This is one of the most convinient methods so far as it helops to clean the whole drive form single interface.

I hope you found this tutorial helpful, stay healthy keep coding.

Related Posts

Google Analytics in Nextjs

Add Google Analytics in Nextjs with Quickest Method

Vercel has recently been adding a feature called the third-party library, which allows us to integrate various third-party tools like Google Analytics in the most performant way possible…

Using Notistack in Nextjs | React js

Showing toast messages in react apps is a common feature to add, as it’s one of the quickest ways to give feedback to users. There are many toast…

Using React Feather Icons in Next js

Feather Icons is a collection of sleek and beautiful icons that you can use in your projects in different ways and integrate seamlessly with React-based applications. To use…

find unused npm packages

Find and Remove Unused NPM Packages from Your Project

While building apps in an NPM environment it’s easy to accumulate lots of NPM packages in our app that we don’t even need, these package slows down our…

Using Bootstrap Icons in Next js | React

Bootstrap Icons is a Free, high-quality, open-source icon library with over 2,000 icons. You can use them as you like SVGs, SVG sprite, or web fonts. We can…

lucide icons

Using Lucide React Icons in Nextjs | React js

Lucide offers a sleek and versatile icon library that seamlessly integrates with your Next.js or React applications. Let’s explore how to leverage Lucide for beautiful, customizable icons: Lucide…

Leave a Reply

Your email address will not be published. Required fields are marked *