Say goodbye to Yarn and say hello to PNPM
Tags: webdev, pnpm, frontend, programming
Published: 2022-04-06 12:24:24

---
title: Say goodbye to Yarn and say hello to PNPM
published: true
date: 2022-04-06 12:15:00 UTC
tags: webdevelopment,pnpm,frontenddevelopment,programming
canonical_url: https://relatablecode.com/say-goodbye-to-yarn-and-say-hello-to-pnpm/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqnxeuy354i6aodby0vh.png
---
### Introduction

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_

> [_https://pnpm.io/_](https://pnpm.io/)

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. 😈

```bash
npm install -g pnpm@next-7
```

And the commands are exactly the same but with a 🅿

### Initial steps for PNPM

![size](https://cdn-images-1.medium.com/max/253/0*VMQgPV69LcXhcXDU)

Alright, we have an initial size of 1.84GB on the disk. Let’s see how much we can lower this down.

![size](https://cdn-images-1.medium.com/max/336/0*4TXgQkb_92gINvP4)

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:

```bash
pnpm install
```

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!

![python](https://cdn-images-1.medium.com/max/281/0*V0ygzIRISyh3bIbu)

Alright, this time is a success:

![success](https://cdn-images-1.medium.com/max/692/0*-GLoBrOaauf5v9n7)

And we get a pnpm lock file:

![pnpm lock file](https://cdn-images-1.medium.com/max/212/0*uz1l9AMwvdrmlOTa)

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:

![size saved](https://cdn-images-1.medium.com/max/249/0*ZHfxrQfMVHJ6pMZ9)

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. 😎

### Conclusion

This was just a very surface-level overview of pnpm. [Their page](https://pnpm.io/pnpm-cli) continues a ton more information on everything it was to offer.

What’s your go-to package manager? Yarn, npm, pnpm? Something else entirely?

More content at [Relatable Code](https://relatablecode.com)

If you liked this feel free to connect with me on [LinkedIn](https://www.linkedin.com/in/relatablecode) or [Twitter](https://twitter.com/relatablecoder)

Check out my free developer roadmap and weekly tech industry news in my [newsletter](https://relatablecode.substack.com/).

_Originally published at_ [_https://relatablecode.com_](https://relatablecode.com/say-goodbye-to-yarn-and-say-hello-to-pnpm/) _on April 6, 2022._