Skip to content

Support V8 C++ APIs for "nan" addons and other packages to work #4290

Open

Description

@xhyrom

Affected packages

  • better-sqlite3
  • node-canvas@v2 (node-canvas v3 is supported)
  • midi
  • libxmljs
  • bignum
  • zeromq
  • node-libcurl
  • bson-ext
  • heapdump
  • @datadog/native-metrics
  • tiny-secp256k1
  • tree-sitter-c-sharp
  • chacha-native
  • @sentry/profiling-node
  • pdfjs-dist
  • gl
  • leveldown / pouchdb
  • sleep
  • cpu-features
  • odbc
  • msgpackr
  • re2
  • node-pty
  • i2c
  • gdal-async
  • dd-trace
  • blake2
  • @confluentinc/kafka-javascript

Functions implemented

  • v8::Isolate::GetCurrent()
  • v8::Isolate::TryGetCurrent()
  • v8::Isolate::GetCurrentContext()
  • v8::Number::New(v8::Isolate*, double)
  • v8::Number::Value() const
  • v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)
  • v8::String::WriteUtf8(v8::Isolate*, char*, int, int*, int) const
  • v8::api_internal::ToLocalEmpty()
  • v8::String::Length() const
  • v8::External::New(v8::Isolate*, void*)
  • v8::External::Value() const
  • v8::Object::New(v8::Isolate*)
  • v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
  • v8::Object::SetInternalField(int, v8::Local<v8::Data>)
  • v8::Object::SlowGetInternalField(int)
  • v8::HandleScope::HandleScope(v8::Isolate*)
  • v8::HandleScope::~HandleScope()
  • v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
  • v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior, v8::SideEffectType, v8::CFunction const*, unsigned short, unsigned short, unsigned short) (only when all parameters past data are their default values)
  • v8::ObjectTemplate::NewInstance(v8::Local<v8::Context>)
  • v8::ObjectTemplate::SetInternalFieldCount(int)
  • v8::ObjectTemplate::InternalFieldCount() const
  • v8::ObjectTemplate::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>) (only when no FunctionTemplate is provided)
  • v8::EscapableHandleScopeBase::EscapeSlot(unsigned long*)
  • v8::EscapableHandleScopeBase::EscapableHandleScopeBase(v8::Isolate*)
  • node_module_register
  • v8::Function::SetName(v8::Local<v8::String>)
  • v8::Value::IsBoolean() const
  • v8::Boolean::Value() const
  • v8::Value::FullIsTrue() const
  • v8::Value::FullIsFalse() const
  • v8::EscapableHandleScope::EscapableHandleScope(v8::Isolate*)
  • v8::EscapableHandleScope::~EscapableHandleScope()
  • v8::Value::IsObject() const
  • v8::Value::IsNumber() const
  • v8::Value::IsUint32() const
  • v8::Value::Uint32Value(v8::Local<v8::Context>) const
  • v8::Value::IsUndefined() const
  • v8::Value::IsNull() const
  • v8::Value::IsNullOrUndefined() const
  • v8::Value::IsTrue() const
  • v8::Value::IsFalse() const
  • v8::Value::IsString() const
  • v8::Boolean::New(v8::Isolate*, bool)
  • v8::Object::GetInternalField(int)
  • node::AddEnvironmentCleanupHook(v8::Isolate*, void (*)(void*), void*)
  • node::RemoveEnvironmentCleanupHook(v8::Isolate*, void (*)(void*), void*)
  • v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long)
  • v8::internal::IsolateFromNeverReadOnlySpaceObject(unsigned long)
  • v8::Array::New(v8::Isolate*, v8::Local<v8::Value>*, unsigned long)
  • v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)

Major areas of unimplemented functionality

  • Array
  • ObjectTemplate with a constructor function
  • Less-simple cases of FunctionTemplate
  • ArrayBuffer
  • bun install fixes (need to pass node-gyp the right version)
  • Doubles
  • UTF-16 strings
  • Persistent handles

What version of Bun is running?

0.8.0+ad326b77342dd3d8585a30b7da803d32f9c11fe2

What platform is your computer?

Linux 6.4.10-artix1-1 x86_64 unknown

What steps can reproduce the bug?

import Database from 'better-sqlite3';
const db = new Database('foobar.db', {});

console.log(db.prepare("CREATE TABLE TEST").run());

What is the expected behavior?

Run as normally

What do you see instead?

/usr/bin/bun: symbol lookup error: /home/hyro/Workspace/booo/node_modules/better-sqlite3/build/Release/better_sqlite3.node: undefined symbol: node_module_register

Additional information

Related thread: 1144181146809270332
Message: https://discord.com/channels/876711213126520882/1144181146809270332/1144184224006557747

All versions are affected

Activity

  1. floydjones1 commented on Aug 24, 2023

    @floydjones1

    This also happens for node-libcurl

  2. changed the title [-]better-sqlite3 doesn't work, missing `node_module_register`[/-] [+]multiple modules doesn't work, missing `node_module_register`[/+] on Aug 24, 2023
  3. changed the title [-]multiple modules doesn't work, missing `node_module_register`[/-] [+]multiple modules don't work, missing `node_module_register`[/+] on Aug 24, 2023
  4. changed the title [-]multiple modules don't work, missing `node_module_register`[/-] [+]`node_module_register` is not implemented[/+] on Aug 25, 2023
  5. changed the title [-]`node_module_register` is not implemented[/-] [+]`node_module_register` is not implemented (better_sqlite3)[/+] on Aug 25, 2023
  6. added
    bun:sqliteSomething to do with bun:sqlite
    napiCompatibility with the native layer of Node.js
    and removed
    bun:sqliteSomething to do with bun:sqlite
    napiCompatibility with the native layer of Node.js
    on Sep 10, 2023
  7. raziman18 commented on Sep 10, 2023

    @raziman18

    I also encounter this error

  8. Zykatious commented on Sep 10, 2023

    @Zykatious

    this also happens for bson-ext

  9. autoscatto commented on Sep 11, 2023

    @autoscatto

    also for heapdump

  10. vroudge commented on Sep 15, 2023

    @vroudge

    same for @datadog/native-metrics

  11. uditdc commented on Sep 16, 2023

    @uditdc

    Likewise for tiny-secp256k1

  12. 175 remaining items

  13. samuelscheit commented on May 23, 2026

    @samuelscheit

    @robobun implement this

  14. exoRift commented on Jun 7, 2026

    @exoRift

    3 years is lowkey a bit wild. Hopefully, this is still high-prio?

  15. ronald-steinke commented on Jun 11, 2026

    @ronald-steinke

    Another current data point for better-sqlite3:

    • Image: oven/bun:1.3.14
    • Package: better-sqlite3@12.10.0
    • Install command: bun install --frozen-lockfile
    • Environment reported by node-gyp: node@24.3.0 | linux | x64

    Bun prints:

    prebuild-install warn install 'better-sqlite3' is not yet supported in Bun.
    Track the status in https://github.com/oven-sh/bun/issues/4290
    

    Then it falls back to node-gyp rebuild --release. In a minimal oven/bun:1.3.14 CI image this failed because there is no Python:

    gyp ERR! find Python You need to install the latest version of Python.
    gyp ERR! configure error
    error: install script from "better-sqlite3" exited with 1
    

    Installing python3 make g++ makes the install step pass, but for CI QA jobs we switched back to node:22-trixie-slim + npm ci, because npm uses the normal Node/prebuild path and installs the same lockfile cleanly without native build tools.

  16. JacobNWolf commented on Jul 15, 2026

    @JacobNWolf

    Just curious: With the Rust port now merged and released, does this make some of this easier? I'd expect Rust to have better interactivity with C++ than Zig, but I'm fairly removed from the intricacies of this issue. That said, really want dd-trace and @confluentinc/kafka-javascript to work here.

  17. sroussey commented on Jul 15, 2026

    @sroussey
    Contributor

    Just curious: With the Rust port now merged and released

    Merged so there can’t be a 1.3.15 bug fix release, but it has not been released. 1.3.14 is the current version, based on zig.

    Would be nice if they were able to close some of the 5000 issues with the rust version though!

  18. Scalahansolo commented on Aug 20, 2026

    @Scalahansolo

    Tried to spin up our linear's stack using Bun 1.4. Got segfaults in re2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

trackingAn umbrella issue for tracking big features

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions