MuhammaraJS icon indicating copy to clipboard operation
MuhammaraJS copied to clipboard

Documentation: `pnpm@10` no longer runs lifecycle scripts on `install`

Open ericbf opened this issue 1 year ago • 6 comments

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?

ericbf avatar Feb 19 '25 16:02 ericbf

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"

ericbf avatar Feb 19 '25 16:02 ericbf

Interesting. I suspect a different call of pre and post install hooks between non and pnpm. Could you add some logging ?

julianhille avatar Feb 19 '25 18:02 julianhille

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

ericbf avatar Feb 19 '25 18:02 ericbf

This is probably a documentation change in MuhammaraJS then, if anything.

ericbf avatar Feb 19 '25 18:02 ericbf

Would you be willing to add those notes for pnpm to the resume as PR?

julianhille avatar Feb 19 '25 19:02 julianhille

Yes, I can do that. Let me run a few local tests to be sure. It’ll be in the next couple days, probably.

ericbf avatar Feb 19 '25 19:02 ericbf

were you able to run tests?

julianhille avatar Jan 30 '26 00:01 julianhille

You know what, I don’t know what happened here. I must have forgotten to follow up.

ericbf avatar Feb 01 '26 21:02 ericbf