News & Announcements
New for Netlify Build: Out of the box support for pnpm
Netlify now has support for pnpm out of the box!
Why developers love pnpm
Known for saving disk space and speeding up build times, pnpm is an alternative Node.js package manager that’s especially popular among developers working with monorepos.
With pnpm, you can share dependencies across multiple projects and any changes to those dependencies only require an update to whatever files have changed within the package instead of updating the entire dependency.
How we implemented support for pnpm
To bring pnpm support to Netlify developers, we implemented a solution using Node Corepack.
Corepack is a promising new way to manage package managers. It provides the flexibility to automatically add support for upcoming package managers through new node versions itself without the need to install them independently. This will allow Netlify to more readily add new package managers in the future, should the need arise.
How to use pnpm with Netlify
Using pnpm with Netlify requires only two steps!
First, you’ll need to check in a
git push Netlify will automatically detect the lock file and run
pnpm install for you.
With pnpm, Netlify takes care of caching the artifacts to make sure your builds are performant.
Old workarounds are no longer needed
Prior to this change, it was possible to use pnpm with Netlify but it required workarounds. Developers found various methods to make pnpm work, some of which required disabling npm.
If you previously used the method that updated the build command to:
NPM_FLAGS = "--version"
command = "npx pnpm i --store=node_modules/.pnpm-store && npm run build"
publish = "dist"
Now you can replace this with a single Netlify build command:
command = "pnpm run build"
Start building with pnpm on Netlify
Support for pnpm has been one of the most highly requested features, and we’re excited to make this available for all developers today! Visit the docs to learn how to get started.