PNPM + Netlify deploy doesn't work

When trying to deploy a very simple project to Netlify using netlify-cli deploy and PNPM it seems the dependencies don’t get installed.

I get the following error:
Cannot find package '@libsql/client' imported from [...]


You can also see that here: https://6635554b2e909556f29f94d2--venerable-scone-e38e3d.netlify.app/

Here’s the deploy logs. All the steps are skipped except “Post-processing”:

4:21:24 PM: Starting post processing
4:21:24 PM: Post processing done
4:21:24 PM: Section completed: postprocessing
4:21:24 PM: Skipping form detection
4:21:24 PM: Post processing - header rules
4:21:24 PM: Post processing - redirect rules
4:21:25 PM: Site is live ✨

Here’s a minimum reproduction of the issue: GitHub - SunFlea/netlify-pnpm-bug: minimum reproduction
Run:

git clone https://github.com/SunFlea/netlify-pnpm-bug
cd netlify-pnpm-bug
pnpm install
netlify deploy

The problem goes away when using npm install instead. Netlify claims PNPM is supported both in a blog post and in the docs. So I don’t know what the issue is.

Thanks.

Have you added shamefully-hoist=true to .npmrc?

Yes, I’ve tried that and it doesn’t make a difference.

I just tried your repo and it appears to work fine: Invocation Failed (6637d3f7c26282127fe888c6–f-117757.netlify.app)

(I get a different error from your dependency but that’s an indication that the dependency is being imported fine).

I only tried with shamefully-hoist, did not try without it.

Did you deploy manually using the commands in my original post or are you deploying via GitHub?
Because it seems to work when deploying via GitHub but not manually when using commands.

Yeah, I’ve made a single deploy via the CLI:

same issue for me when using netlify deploy --build on Windows (git bash), then my site breaks.

When it tries to run the server function, I see
error decoding lambda response: error decoding lambda response: unexpected end of JSON input

this is due to the build failing to import @astrojs/netlify
Feb 3, 05:29:46 AM: ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Cannot find package '@astrojs/netlify' imported from /var/task/.netlify/build/entry.mjs","code":"ERR_MODULE_NOT_FOUND",

Deploying via automatic CI through github work fine

Also, interestingly, using wsl (Linux Subsystem with Windows 11) on the same PC, the CLI works fine and the site functions as expected

I raised this here:
netlify deploy with pnpm install on Windows breaks Astro site SSR · Issue #7020 · netlify/cli