Image for post
Image for post
Didn’t give pnpm a chance yet? No problem! v2 is out, with more features and battle-tested on huge projects. Photo by Franck V.

pnpm version 2 is out!

Zoltan Kochan
May 23, 2018 · 5 min read
Image for post
Image for post

So what’s new in pnpm since v1.0?

The store server

We added the store server to pnpm in v1.30. The store server is an app that can run in a separate process and handle all the store manipulations, reducing the number of tasks that pnpm install should do. With a store server, installations are faster and concurrent installations may run using the same store.

The recursive commands

Everyone seems to like multi-package repositories lately but managing a multi-package repo is hard. In v1.24 of pnpm, we implemented our first recursive commands: pnpm recursive install and pnpm recursive update.

Image for post
Image for post
The output of running `pnpm recursive link`

The ability to create flat node_modules

As you may know, one of the great features of pnpm is that it creates a non-flat node_modules (you can read more about why this is a great feature in this article). However, we discovered that many packages in the ecosystem are broken, they use dependencies that are not declared in their package.json. When we see such packages, we try to submit pull requests and fix them. It takes time though, to discipline the ecosystem, that is why Emanuele Tamponi has implemented the shamefully-flatten config in version 1.34.

Headless installation

The most complex part of the installation is the resolution stage. After the resolution stage pnpm knows what should be installed where. But when a project already has a shrinkwrap.yaml, there is no need to repeat the resolution stage. That’s why we created a dedicated package (@pnpm/headless) that can install really fast but only using information from a shrinkwrap.yaml.

And many more…

TBH, there were so many new features and improvements that I didn’t even mention them all, like side effects caching, better console reporting and new ways to import packages from the store. So just open our docs and read the descriptions of all the different commands… or just give pnpm a try on your project! (how to install pnpm)

Breaking changes

Node.js 4 is not supported anymore

End of life of Node.js 4 was on April 30th. This was the main reason we needed to make a major version bump. A lot of our dependencies started to drop Node.js 4 support months before its end of life, so we had to make the same as soon as possible.

Non-deprecated versions are preferred during resolution

This is a breaking change that npm v6 did as well. If a semver range can be resolved by a deprecated and non-deprecated version of a package, then the non-deprecated version is used even if it is a smaller version than the deprecated one.

`pnpm unlink` is an alias of `pnpm dislink`

In version 1, pnpm unlink was an alias of the pnpm uninstall command. However, we wanted a command that would remove a linked package created by pnpm link and install it from the registry, so we create pnpm dislink. In order to avoid confusion, now we’ve made pnpm unlink an alias of pnpm dislink.

Try it

Just install pnpm via npm: npm install -g pnpm. And use it instead of npm whenever you want to install something: pnpm i foo.


About the pnpm JavaScript package manager

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store