-
Notifications
You must be signed in to change notification settings - Fork 155
Add support for zeromq
#391
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
Comments
You can try If its missing prebuilds, then it is likely an issue with You can create a PR with a test and special case, similar to PR #37. Or if you want to fix the general case (likely a dynamic require somewhere) that would be great too (albeit much harder). |
@styfle Many thanks for the guidance. I will investigate that route this afternoon! :) |
@styfle Indeed it certainly does not bring in the binaries:
|
@styfle I will provide a PR tomorrow. |
Also see this related PR that mentions node-gyp-build That might lead to the more general purpose fix instead of a special case. |
I will do the general purpose one. I think I understood the tracing logic a bit. |
…evel where de require() is run at. Fixes zeromq.js. Closes vercel#391.
@styfle Can you have a look? 👀 🙇 |
- Fixes #391 Three things I want to point out: 1. In zeromq the way node-gyp-build is called is by passing `path.join(__dirname, "..")` instead of `__dirname` to the `require("node-gyp-build")(...)` call. 2. In zeromq they use `@aminya/node-gyp-build` instead of `node-gyp-build`, particular-li version `4.5.0-aminya.5`. 3. The zeromq version that's recommended for new project is the `6` which is beta according to @aminya https://github.com/zeromq/zeromq.js. After those changes it resolves OK. ``` ❯ node ./node_modules/@vercel/nft/out/cli.js print ./node_modules/zeromq/lib/index.js FILELIST: node_modules/@aminya/node-gyp-build/index.js node_modules/@aminya/node-gyp-build/package.json node_modules/zeromq/lib/draft.js node_modules/zeromq/lib/index.js node_modules/zeromq/lib/native.js node_modules/zeromq/lib/util.js node_modules/zeromq/package.json node_modules/zeromq/prebuilds/darwin-x64/node.napi.glibc.node <---- It worked! ``` --------- Co-authored-by: Steven <steven@ceriously.com>
🎉 This issue has been resolved in version 0.26.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@styfle how can I test this? I am trying to use the I also set I'm very confused because at this commit https://github.com/vercel/next.js/blob/07c652a1200445ebfed8ef13426e36a150a04a67/packages/next/package.json#L194 (Next.js 14.1.1-canary.52) I can see the nft version set at 0.26.4. Can you help me set up a project with a next app that has my changes? |
@styfle I can see the tagged next git repo
0c21654845f78717a8198a69d968671477adc7f8 is the commit of the canary branch that has the changes I want. Would that work? The next.js repo has many packages: next, eslint-config-next, etc... I don't know if putting a git url in packages.json is the best solution for testing my changes.... |
@eulersson A new canary was just released with the fix. You can run https://github.com/vercel/next.js/releases/tag/v14.1.1-canary.53 |
Still not working @aminya @styfle. Do you have any idea what might be the issue?
However the nft version is correct and brings in the binary.
It breaks here at the throw error: The variable
I will attach here the contents of To reproduce simply import |
This will fix it: |
@styfle I confirm it works now! Thanks for your help 🙏 |
Some libraries like
zeromq.js
need runtime libraries with bindings which they ship along. Those binaries exist undernode_modules/zeromq/prebuilds
.Simply by creating a new Next.js app, installing https://github.com/zeromq/zeromq.js and trying to import it and running
npm run dev
and use one of its classes would throw aNo native build was found for platform=linux arch=x64 runtime=node abi=115 uv=1 libc=glibc node=20.11.0 webpack=true loaded from: /app/.next/server
. I found out that if I print thisdir
variable used (among other things) to search for binaries in node-gyp-builder it print.next/server/...
instead ofnode_modules/...
and since the binaries have not been copied it fails.Note
I provided a reproducible example and a container, but it's easily reproducible on mac and linux: https://github.com/eulersson/zeromq.js-next.js-errors
I tried using the
outputFileTracingIncludes
option as explained in https://nextjs.org/docs/pages/api-reference/next-config-js/output#caveats but without success.Here's the files I would like to have in
.next/server
.Since I don't know in what area work should be done I posted the same problem as an issue to the various tools involved:
Thanks for the help and apologies if I have been generating noise by posting so many issues.
The text was updated successfully, but these errors were encountered: