Open robobun opened 1 year ago
Using leveldb (after running postinstall) throws:
1 | (function (id) {"use strict";
^
TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
at internalRequire (:1:20)
at load (/Users/codermickey/Development/buntest/node_modules/node-gyp-build/node-gyp-build.js:22:9)
at /Users/codermickey/Development/buntest/node_modules/classic-level/binding.js:1:7
at globalThis (/Users/codermickey/Development/buntest/node_modules/classic-level/binding.js:1:52)
at require (:1:20)
at /Users/codermickey/Development/buntest/node_modules/classic-level/index.js:7:6
at globalThis (/Users/codermickey/Development/buntest/node_modules/classic-level/index.js:190:23)
consider renaming this issue
This is also very urgent for us.
when use bun with uWebSocket.js, i got same error.
./uws_linux_x64_115.node
18 | module.exports = (() => {
19 | try {
20 | console.log('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules + '.node')
21 | return require('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules + '.node');
22 | } catch (e) {
23 | throw new Error('This version of uWS.js supports only Node.js LTS versions 16, 18 and 20 on (glibc) Linux, macOS and Windows, on Tier 1 platforms (https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list).\n\n' + e.toString());
^
error: This version of uWS.js supports only Node.js LTS versions 16, 18 and 20 on (glibc) Linux, macOS and Windows, on Tier 1 platforms (https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list).
TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
at /home/saltfish/Mems/Dummy/service/routesservice/node_modules/uWebSockets.js/uws.js:23:8
at /home/saltfish/Mems/Dummy/service/routesservice/node_modules/uWebSockets.js/uws.js:23:239
at globalThis (/home/saltfish/Mems/Dummy/service/routesservice/node_modules/uWebSockets.js/uws.js:25:3)
at overridableRequire (:1:20)
at /home/saltfish/Mems/Dummy/service/routesservice/dist/index.js:37336:20
at /home/saltfish/Mems/Dummy/service/routesservice/dist/index.js:18:74
at /home/saltfish/Mems/Dummy/service/routesservice/dist/index.js:40495:35
Same issue when using ssh2
Same issue using package bcrypt
in typescript
Running env
Bun version 1.1.0
OS windows 11
Same-ish issue using raspi-io
1.1.9
Debian GNU/Linux 12 (bookworm)
piserver@raspberrypi:~/elysia2/app $ bun run src/index.ts
107 | return opts[p] || p;
108 | })
109 | );
110 | tries.push(n);
111 | try {
112 | b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
^
TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
at bindings (/home/piserver/elysia2/app/node_modules/bindings/bindings.js:112:48)
at /home/piserver/elysia2/app/node_modules/pigpio/pigpio.js:6:7
at /home/piserver/elysia2/app/node_modules/raspi-gpio/dist/index.js:27:7
at /home/piserver/elysia2/app/node_modules/raspi-io/dist/index.js:30:7
Bun v1.1.9 (Linux arm64)
Same with "@parcel/watcher": "^2.4.0"
while using --hot
only.
│ at /Users/**/**/node_modules/@parcel/watcher/index.js:15:13
│ 10 | }
│ 11 | }
│ 12 |
│ 13 | let binding;
│ 14 | try {
│ 15 | binding = require(name);
│ ^
│ TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
│ at /Users/**/**/node_modules/@parcel/watcher/index.js:15:13
Edit
Just for the records it works with dynamic import const watcher = await import('@parcel/watcher');
Did someone solve this? I'm getting the same error with bcrypt
1 | 'use strict';
2 |
3 | var nodePreGyp = require('@mapbox/node-pre-gyp');
4 | var path = require('path');
5 | var binding_path = nodePreGyp.find(path.resolve(path.join(__dirname, './package.json')));
6 | var bindings = require(binding_path);
^
TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
at /Users/.../api/node_modules/bcrypt/bcrypt.js:6:16
EDIT: I found out that we don't even need bcrypt with Bun: https://bun.sh/guides/util/hash-a-password This is enough for us.
If you were using lz4
like me, switch to lz4js
. API is a little different and uses Uint8Array
instead of Buffer
but that's totally acceptable.
I can reproduce this when using node:worker_threads
.Worker instead of the Bun global worker for requiring a .node
file.
Works:
const blob = new Blob( [`require('./node_modules/rocksdb/prebuilds/darwin-x64+arm64/node.napi.node')`, ],{type: "application/typescript",},);
const blobURL = URL.createObjectURL(blob);
const worker = new Worker(blobURL);
Doesn't work:
const blob = new Blob( [`require('./node_modules/rocksdb/prebuilds/darwin-x64+arm64/node.napi.node')`, ],{type: "application/typescript",},);
const blobURL = URL.createObjectURL(blob);
const worker = new (require('node:worker_threads').Worker)(blobURL);
error:
> 184 | postMessage(...args) {
185 | return this.#worker.postMessage(...args);
186 | }
187 | #onClose(e) {
188 | this.#onExitPromise = e.code, this.emit("exit", e.code);
189 | #onError(event) {
^
error: 1 | require('./node_modules/rocksdb/prebuilds/darwin-x64+arm64/node.napi.node')
^
TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
Same error with @project-osrm/osrm
:
TypeError: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?
at /home/xxx/node_modules/@project-osrm/osrm/lib/index.js:1:19
Same error when using zlib-sync
https://npmjs.com/package/zlib-sync
Originally reported on Discord:
Running
bun --hot server.tswith leveldb thro...