Clear the reason
As front-end developers, we use NPM to manage development and runtime dependencies. When running NPM or YARN, megabytes of node_modules are downloaded. The more projects we do, the more node_modules are stored and the computer starts to get stuck.
npkill
The software package Npkill lists each nodemodules folder on your system, along with the space they occupy. You can then choose which Nodemodules folders to delete.
use
Use the following command
npx npkill
Copy the code
By default, npkill searches your current directory. To override it, use the –directory argument
npx npkill --directory ~/dev
Copy the code
As you can see in the screenshot, npkill shows all of our node_Modules folders and allows us to delete them, one at a time, by hitting the space bar.
We can also use npkill to delete more node_modules folders. Another good way to clear up space on your machine is to delete all the dist folders. To do this with npkill, simply use the –target argument.
npx npkill --target dist
Copy the code
For more information about the various parameters accepted by npkill, check out their Github repository :github.com/voidcosmos/…