Skip to content

Add support for zeromq #391

@eulersson

Description

@eulersson

Some libraries like zeromq.js need runtime libraries with bindings which they ship along. Those binaries exist under node_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 a No 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 this dir variable used (among other things) to search for binaries in node-gyp-builder it print .next/server/... instead of node_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.

❯ tree node_modules/zeromq/prebuilds
node_modules/zeromq/prebuilds
├── darwin-arm64
│   └── node.napi.glibc.node
├── darwin-x64
│   └── node.napi.glibc.node
├── linux-x64
│   ├── node.napi.glibc.node
│   └── node.napi.musl.node
├── win32-ia32
│   └── node.napi.glibc.node
└── win32-x64
    └── node.napi.glibc.node

6 directories, 6 files

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions