Say goodbye to Yarn and say hello to PNPM
• 3 min read
PNPM is a package manager that I have seen floating around for quite some time now. It’s tagged as a “fast, disk space-efficient package manager”. But in what ways? Well, let’s take the quote straight from them as well.
Files inside node_modules are linked from a single content addressable storage
Cool so all projects share the same node_modules. But…. let’s make this more interesting. I’ll take a small folder I have with 5 projects or so. Hook it up to pnpm and see the size difference.
How to use PNPM
Let’s use npm to install pnpm. 😈
npm install -g pnpm@next-7
And the commands are exactly the same but with a 🅿
Initial steps for PNPM
Alright, we have an initial size of 1.84GB on the disk. Let’s see how much we can lower this down.
Took like 5 minutes for SSD to delete the node_modules folders for those projects.
Alright, now we can get started for real. In the terminal I just have to execute:
But it failed on the postinstall script phase, with the following error:
│ gyp verb check python checking for Python executable "python2" in the PATH │ gyp verb `which` failed Error: not found: python2 │ gyp verb `which` failed at getNotFoundError (C
Apparently, I didn’t have my Python environment variable set!
Alright, this time is a success:
And we get a pnpm lock file:
But it does seem to give me a critical-looking error message for not having a peer dependency. Regardless I’ll quickly do the other projects.
And I ended up saving:
This may not seem like much but these were just 5 loosely related projects. Multiplied across the entirety of my local repositories and I could be saving a lot more. Another important thing to note is that it feels faster and the logs from the installation were easier on the eyes.
This benefit is even larger in companies or workspaces with a ton of projects with similar dependencies. 😎
This was just a very surface-level overview of pnpm. Their page continues a ton more information on everything it was to offer.
What’s your go-to package manager? Yarn, npm, pnpm? Something else entirely?
If you liked this feel free to connect with me on LinkedIn or Twitter
Check out my free developer roadmap and weekly tech industry news in my newsletter.
If you see any typos or errors you can edit the article directly on GitHub
Hi, I'm Diego Ballesteros 👋.
Stay on top of the tech industry and grow as a developerwith a curated selection of articles and news alongside personal advice, observations, and insight. 🚀
No spam 🙅♂️. Unsubscribe whenever.
You may also like these articles: