Recently I had mentioned a small tool, called as
npmkill that helps you locate and delete
node_modules heavy folders that are sitting on your disk and eating up disk space.
As mentioned earlier, I have been holding a lot of Github repositories based on the “NPM” ecosystem, both personal and company projects on my machine. Each repository requires NPM install, obviously 😁. The process takes some space, but since eventually it will be bundled on production so I care less. Since the invention and consumption of SSD, hard disk sizes are getting smaller (because the price for SSD is higher). Thus one has to use the limited space with utter care.
The point with
npmkill was to delete the space used by node_modules, while the point of PNPM is to store exact same modules centrally, which means if you have large number of projects using same version of react, it makes more sense to have it located centrally on same machine, more of symlink cache. That’s what
So here is PNPM, PNPM creates a hard symlink in the central location for modules, which means that there is only one copy of the same module on your machine. If you are using the same version of a library in 100s of projects on your machine, pnpm will only save a single copy of it on your machine and make it accessible from all repositories.
Result? you end up saving tons of gigabyte on your disk. On another side, the installation is also faster and saves some network bandwidth.
Here is another big post on why we should use pnpm
You can install using
npm install -g pnpm or
npx pnpm add -g pnpm
and subsequently update it via
pnpm add -g pnpm
This will install the pnpm module globally on your machine and pnpm cli would be available.
Just use pnpm in place of npm. For instance, to install run:
For more advanced usage, read pnpm CLI on our website.
npm has a great package runner called
npx. pnpm also offers the same functionality.
pnpx create-react-app my-cool-new-app
Official Repo: PNPM