Going from NPM to PNPM

Last Edited On: November 6, 2023 @ 6:10 PM

I have come across an issue on my beat up mac, it was really low on storage. After searching for a while I realised that a lot of my storage was taken up by 1. things I no longer used and 2. node-modules. So I remember seeing other ways of installing packages instead of just the npm route. There others like brew ,pnpm ,yarn and the newest one bun

I knew brew and yarn but did not know the other two pnpm and bun. Did some reading and found out that the bun was a brand new at this point and pnpm was just a way on how npm packages were stored. I wanted something that would work right away without many interruptions to workflow and going out of my way to look up why I can’t import a library.

So as of now I will not go with bun but will go with pnpm it was really straight forward just adjust all of my projects on how they are structured and thats all. So it was done now im using pnpm with all my new projects from now on but the issue is still not resolved I still don’t have storage.

Well after some googling I found ways to delete all of the node_modules that are on my computer. But one of the easiest ones I found was npkill it is a package that you have to install with the -g tag but when run it will look through all of your directories and get rid of all of the node-module folders. Also really cool will also say how much storage its taking up and how much has been cleared up.

How to install it

npm i npkill -g

cd in to a dir that you would like to run the command in npkill and delete which ones you do not need/want