Documentation: `pnpm@10` no longer runs lifecycle scripts on `install`
Not sure what’s the issue here. I’m building my container using the official node:22-bookworm as the base. When I try to run my app, I see this error:
Error: Cannot find module '/app/node_modules/.pnpm/[email protected]/node_modules/muhammara/binding/muhammara.node'
Require stack:
- /app/node_modules/.pnpm/[email protected]/node_modules/muhammara/lib/muhammara.js
- /app/node_modules/.pnpm/[email protected]/node_modules/muhammara/lib/index.js
- ... (application code)
If I check my local install (outside of docker, in MacOS 15.3 on M2), I see that .node binding file, but inside the container, it seems to be missing. Running pnpm install muhammara doesn’t result in any errors in the container. I’ve tried different versions of MuhammaraJS, 5.1.0, 5.3.0, even down to 4.x. Any ideas?
For example, with this Dockerfile:
#syntax=docker/dockerfile:1
FROM docker.io/node:22-bookworm
RUN npm install -g pnpm
WORKDIR /app
RUN pnpm install [email protected]
CMD ls "node_modules/muhammara"
You can see that the binding folder is missing.
Contrast that with the npm version, and the binding folder is present.
#syntax=docker/dockerfile:1
FROM docker.io/node:22-bookworm
WORKDIR /app
RUN npm install [email protected]
CMD ls "node_modules/muhammara"
Interesting. I suspect a different call of pre and post install hooks between non and pnpm. Could you add some logging ?
Ok, I see. Looks like pnpm@10 no longer runs install scripts automatically.
# pnpm i --loglevel verbose [email protected]
Packages: +13
+++++++++++++
Progress: resolved 13, reused 13, downloaded 0, added 13, done
dependencies:
+ muhammara 5.3.0
╭ Warning ───────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Ignored build scripts: muhammara. │
│ Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts. │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
Done in 786ms using pnpm v10.4.1
I reverted inside my docker container to pnpm@9 and install worked as expected without any other configuration. I’ll probably add muhammara to my package.json under pnpm.onlyBuiltDependencies to allow it to build automatically.
See the first point in their release notes here: https://github.com/orgs/pnpm/discussions/8945
This is probably a documentation change in MuhammaraJS then, if anything.
Would you be willing to add those notes for pnpm to the resume as PR?
Yes, I can do that. Let me run a few local tests to be sure. It’ll be in the next couple days, probably.
were you able to run tests?
You know what, I don’t know what happened here. I must have forgotten to follow up.