Skip to content

Report 'no such built-in module' when load addon file #109

@kerwenzhang

Description

@kerwenzhang

I created a simple demo hello.node

#define NAPI_VERSION 3
#define NAPI_CPP_EXCEPTIONS
#include <napi.h>

Napi::String Method(const Napi::CallbackInfo& info) {
  Napi::Env env = info.Env();
  return Napi::String::New(env, "world from addon");
}

Napi::Object Init(Napi::Env env, Napi::Object exports) {
  exports.Set(Napi::String::New(env, "hello"),
              Napi::Function::New(env, Method, "hello"));
  return exports;
}

NODE_API_MODULE(hello, Init)

And call it in node.js express project

app.js
app.use('/hello', function(req, res) {
    const modulePath = path.join(__dirname, 'hello.node');
    const addon = require(modulePath);

    res.send(addon.hello()); // 'world'
});

Run express project directly(node app.js), the addon file could be loaded successfully. But after I package it to exe using Node SEA, it begin to report below error during run exe.
image

@nodejs/single-executable
Does that mean Node SEA bootstrap not support to load addon file? Does Node SEA have a plan to support .node file? What's the latest progress?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions