-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Add PNPM support #1633
Comments
Hi @jcayzac, This sounds good. Most of this would need to be implemented in the |
For those who need a quick workaround (like me). This seems to work: https://community.netlify.com/t/using-pnpm-and-pnpm-workspaces/2759 |
The trick mentioned above |
Hi @Jack-Works, can you give more details of your solution? I am having similar issues for using pnpm with netlify, thanks |
[build]
command = "./scripts/netlify.sh"
[build.environment]
NPM_FLAGS="--prefix=./scripts/empty-project/"
#!/bin/bash
set -xeuo pipefail
test "$CI" = true || exit 1
npx pnpm install -r --store-dir=node_modules/.pnpm-store
# other build scripts
{
"description": "This is an empty project used as the destination of netlify npm install."
} |
@Jack-Works thanks |
Another option to prevent npm to do anything is to pass the [build.environment]
NPM_FLAGS = "--version"
[build]
command = "npx pnpm install --store=node_modules/.pnpm-store && npx pnpm build" @ehmicky what would you think of adding a |
For some information, the major Vue and Vite repos have now moved to This is what we have to do to have pnpm work with Netlify. https://github.com/vuejs/vue-next/blob/master/netlify.toml#L3 Even if we can't have built-in pnpm support right now, I would love to see a more elegant solution to disable the NPM installs similar to @bpierre's proposal (or even make it aware of |
Svelte is also all in on |
sharing some feedback we received on our docs site on the Monorepos page in support of this feature:
|
Please add pnpm! Netlify is such a great product but not having pnpm by default is a pain. Especially for monorepos which is now trendy. |
We got another request on the docs site for PNPM support (also on the Monorepos page):
|
Just adding a bit more fuel to the fire for supporting PNPM by default! Thank you! |
I have found this thread also in hopes of an official support method... |
Would really appreciate pnpm support! |
+1 |
1 similar comment
+1 |
The workaround works fine but it'd be cleaner to have native support for it. +1 |
related netlify forum thing not that it really changes anything. https://answers.netlify.com/t/using-pnpm-and-pnpm-workspaces/2759 |
+1 |
When will PNPM support be added? 😏 |
+1 |
Sorry folks that you waited that long for it but I'm already working on it. Stay tuned :) |
Thanks @lukasholzer! 👍 When is the new build image going live? |
Hey doing a graduate slow rollout to test if we are not breaking any edge cases worrying a little bit about folks that used a hacky way to install pnpm over the build command. But it's already in progress to roll it out ;) |
Do I have to edit any config for using PNPM? I tried setting the build command to pnpm build, but it didn't work |
@hnrq Worked for me. Maybe you're not part of the rollout yet? |
@janosh probably. Tried using the same netlify.toml as you but no success 🤔 |
Yea I rolled it out to 20% of our starter accounts and going to increase this number now. Nothing special needs to be configured. Just like with npm (If you have a pnpm lock file we will automatically do the pnpm install). [Edit]: Current rollout progress is on 70% of our starter accounts If everything is going fine today I will release it to all by the end of the day (CEST) |
@janosh nice to hear! 🥳 |
I've rolled it out to all customers now. |
awesome work @lukasholzer, thanks a lot! 👏 can we expect an official announcement and/or documentation? |
For sure @matepapp we are internally already working on it! |
Docs are updated here: https://docs.netlify.com/configure-builds/manage-dependencies/#pnpm 🎉 |
Thank you so much for your hard work, this is very exciting! |
Small question: how do you folks handle pnpm workspaces? I have a project with a pnpm workspace which I hadn't been able to deploy in netlify because is trying to do
Still netlify tries to run Any ideas? |
Hey you can force it with see: #4648 (comment) |
Thanks that made it work! |
@lukasholzer I hesitated to open a new issue for this, but any chance that the version of pnpm that Netlify uses is heavily outdated? pnpm v8.0.0 came out this week, but Netlify still runs on v7.13.4 it seems. My builds suddenly fail after updating to pnpm 8 locally (it has a new lockfile format) and I get this message in my Netlify build output: |
Hi @Anoesj thanks for reaching out. Netlify just has a default version installed (I agree we are sadly some versions behind here) This is the version you get if you don't specify anything. But we are using Node corepack for managing package managers. So you should be always able to install the version you want to have installed. Only if you don't specify something you get our version. You can specify the version by specifying it via the See our docs for further information: |
Which problem is this feature request solving?
pnpm is a robust, mature dependency manager for Node.js projects, and is much faster than npm and yarn. It elegantly solves npm doppelgängers problem and has stricter module resolution, solving yarn ghost modules.
Currently, Netlify users need to use workarounds in order to use pnpm, involving altering a proper project configuration and making it less optimal.
Describe the solution you'd like
Build images should have
pnpm@latest
preinstalled as a global npm module.If a
pnpm-lock.yaml
file is detected in thebuild.base
folder,pnpm install --frozen-lockfile
should be run instead ofnpm install
(or even better, the install command should just be exposed as a configuration value so that people can run what they want instead ofnpm install
).Can you submit a pull request?
YesNoMaybe.The text was updated successfully, but these errors were encountered: