You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically create a next app npx create-next-app@latest with all the defaults, install
zeromq npm install zeromq@6.0.0-beta.19, import it anywhere in app/page.tsx (e.g. import { Push } from "zeromq"; and const sock = new Push(); anywhere in your file),
start the development server npm run dev and visit http://localhost:3000.
Reproducible Container
Clone this repository git@github.com:eulersson/zeromq.js-node.js-errors.git
Build the Debian Docker container provided docker build -t zeromq-nextjs
Run the Next.js development server container docker run --rm -it -p 3000:3000 nextjs-zeromq
Visit http://localhost:3000 on your host browser.
Result: Many "No native build was found for" errors server logs and an error screen on the browser.
Should: Not error.
Maybe it's related to the way Next.js compiles the pacakges?
Note
The zeromq@5 package fails too (if you try installing it you need to apt-get update && apt-get install python make cmake g++ first).
Observations
If I change this line in the node-gyp-build/index.js to dir = '/absolute/path/to/node_modules/zeromq' then it works! It seems that it needs to be in .next/server... Because it looks for the prebuilds in there. I read and tried (unsuccessfully) the feature to includes files to the tracing process that happens where only the relevant files are moved to .next/server so a standalone server can use that reduced selection of dependencies.
Error Log
root@3ae29fabb9db:/app# npm run dev
> my-app@0.1.0 dev
> next dev
▲ Next.js 14.1.0
- Local: http://localhost:3000
✓ Ready in 2.3s
○ Compiling /not-found ...
warn - No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.
warn - https://tailwindcss.com/docs/content-configuration
✓ Compiled / in 7.3s (471 modules)
Error: 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
at load.path (webpack-internal:///(rsc)/./node_modules/@aminya/node-gyp-build/index.js:50:11)
at load (webpack-internal:///(rsc)/./node_modules/@aminya/node-gyp-build/index.js:20:32)
at eval (webpack-internal:///(rsc)/./node_modules/zeromq/lib/native.js:6:123)
at (rsc)/./node_modules/zeromq/lib/native.js (/app/.next/server/vendor-chunks/zeromq.js:40:1)
at __webpack_require__ (/app/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///(rsc)/./node_modules/zeromq/lib/index.js:7:16)
at (rsc)/./node_modules/zeromq/lib/index.js (/app/.next/server/vendor-chunks/zeromq.js:30:1)
at __webpack_require__ (/app/.next/server/webpack-runtime.js:33:42)
at eval (webpack-internal:///(rsc)/./app/page.tsx:7:64)
at (rsc)/./app/page.tsx (/app/.next/server/app/page.js:217:1)
at Function.__webpack_require__ (/app/.next/server/webpack-runtime.js:33:42)
at async eq (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:402260)
at async tr (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:405987)
at async tn (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:406537)
at async tn (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:406668)
at async tu (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:2057)
at async /app/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:2564 {
digest: '3408682970'
}
[... See full error log below ...]
Many "No native build was found for ..." when importing and using the TypeScript bindings.
I wrote a reproducible container at https://github.com/eulersson/zeromq.js-next.js-errors
Environment
Note
It also happens in macOS 14.1.1
Reproduction Steps
Manually
Basically create a next app
npx create-next-app@latestwith all the defaults, installzeromq
npm install zeromq@6.0.0-beta.19, import it anywhere inapp/page.tsx(e.g.import { Push } from "zeromq";andconst sock = new Push();anywhere in your file),start the development server
npm run devand visithttp://localhost:3000.Reproducible Container
git@github.com:eulersson/zeromq.js-node.js-errors.gitdocker build -t zeromq-nextjsdocker run --rm -it -p 3000:3000 nextjs-zeromqhttp://localhost:3000on your host browser.Maybe it's related to the way Next.js compiles the pacakges?
Note
The
zeromq@5package fails too (if you try installing it you need toapt-get update && apt-get install python make cmake g++first).Observations
If I change this line in the
node-gyp-build/index.jstodir = '/absolute/path/to/node_modules/zeromq'then it works! It seems that it needs to be in.next/server... Because it looks for the prebuilds in there. I read and tried (unsuccessfully) the feature to includes files to the tracing process that happens where only the relevant files are moved to.next/serverso a standalone server can use that reduced selection of dependencies.Error Log
See full error log: full-error-log.txt