zeromq.js icon indicating copy to clipboard operation
zeromq.js copied to clipboard

`prepare` script missing `run-s`

Open rotu opened this issue 9 months ago • 4 comments

Describe the bug

Installing globally from the github repo fails.

Reproducing

$ docker run -t --rm alpine ash -c "cd ~ && apk add npm git && npm install --global github:zeromq/zeromq.js"
...
npm error npm error code 127
npm error npm error path /root/.npm/_cacache/tmp/git-cloneebMIGo
npm error npm error command failed
npm error npm error command sh -c run-s build.js
npm error npm error sh: run-s: not found

It seems like the dependency npm-run-all2 is not getting its bin links installed before the prepare script runs.

Expected behavior

I expect installation to succeed.

Tested on

  • OS: MacOS
  • ZeroMQ.js version: N/A

rotu avatar Mar 24 '25 23:03 rotu

I think this is a bug in npm, specifically https://github.com/npm/cli/issues/6080

rotu avatar Mar 24 '25 23:03 rotu

You don't need to build zeromq from the source to use it. Just install the production dependencies.

If you want to build from the source anyway, here's a docker file example: https://github.com/zeromq/zeromq.js/blob/master/docker/alpine.dockerfile

You can add a runtime stage that copies over the prebuilds, lib, and installs the production dependencies.

Regardless, the npm failure is surprising and a p0 issue in my opinion. Try with pnpm if you can.

aminya avatar Mar 24 '25 23:03 aminya

You don't need to build zeromq from the source to use it. Just install the production dependencies.

I know. The reason I was installing from source is because I wanted to see what it would take to get just the binaries I needed and for hacking on this project. The above script is obviously missing some platform dependencies anyway.

Confirmed that installing with pnpm does not experience this bug. But pnpm install also does not tolerate --build-from-source as a commandline argument.

Ironically, the obvious workaround is broken; even with the --ignore-scripts flag, it runs the prepare script and crashes.

rotu avatar Mar 25 '25 00:03 rotu

Dev support via npm isn't supported anyway. I can specify pnpm as a package manager so it works with corepack.

Btw, you can pass build-from-source in .npmrc.

aminya avatar Mar 29 '25 07:03 aminya