Skip to content

error C2039: 'Holder': is not a member of 'v8::FunctionCallbackInfo<v8::Value>' when using electron 36.0.0-beta.4 #996

Closed

Description

@oalfroukh

Hi team,

  • We're encountering a breaking issue when building native modules using nan@2.22.2 in combination with Electron v36.0.0-beta.4.

  • The issue arises due to the use of info.Holder() in nan_callbacks_12_inl.h(112,62) In newer versions of V8, particularly as used in Electron 36, info.Holder() is not a valid member of FunctionCallbackInfo. This results in the following build error:

electron-quick-start-main-v36\node_modules\nan\nan_callbacks_12_inl.h(112,62): error C2039: 'Holder': is not a member of        
'v8::FunctionCallbackInfo<v8::Value>' [electron-quick-start-main-v36\native\test\build\test.vcxproj]
  • Code Context:
    In our code, we had this pattern:
 obj->Wrap(info.Holder());
 info.GetReturnValue().Set(info.Holder());
  • Minimal Repro:

Here's a simplified example that fails on Electron 36:

#include <nan.h>

class Dummy : public Nan::ObjectWrap {
public:
  static NAN_MODULE_INIT(Init) {
    v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
    tpl->SetClassName(Nan::New("Dummy").ToLocalChecked());
    tpl->InstanceTemplate()->SetInternalFieldCount(1);

    constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked());
    Nan::Set(target, Nan::New("Dummy").ToLocalChecked(),
             Nan::GetFunction(tpl).ToLocalChecked());
  }

private:
  explicit Dummy() {}
  ~Dummy() {}

  static NAN_METHOD(New) {
    if (info.IsConstructCall()) {
      Dummy* obj = new Dummy();
      obj->Wrap(info.Holder());  // <-- ❌ This will cause the issue
      info.GetReturnValue().Set(info.Holder());
    }
  }

  static inline Nan::Persistent<v8::Function>& constructor() {
    static Nan::Persistent<v8::Function> my_constructor;
    return my_constructor;
  }
};

NAN_MODULE_INIT(InitAll) {
  Dummy::Init(target);
}

NODE_MODULE(addon, InitAll)

Activity

  1. szegedi commented on May 6, 2025

    @szegedi

    Same issue happens when trying to compile C++ code using Nan targeting the just released Node.js 24.0.0.

  2. Apollon77 commented on May 7, 2025

    @Apollon77

    Same issue with Node.js 24

  3. bimalkjha commented on Jun 12, 2025

    @bimalkjha

    PR #979 has fix for this issue. Thanks.

  4. agracio commented on Jun 17, 2025

    @agracio
    Contributor

    PR #1000. Fingers crossed it will be accepted.

  5. Apollon77 commented on Jul 25, 2025

    @Apollon77

    seems nan 2.23.0 fixes it?

  6. agracio commented on Jul 25, 2025

    @agracio
    Contributor

    Yes

  7. Apollon77 commented on Jul 25, 2025

    @Apollon77

    Then this issue can be closed

  8. agracio commented on Jul 25, 2025

    @agracio
    Contributor

    It is up to the author or nan maintainers.

  9. bimalkjha commented on Jul 26, 2025

    @bimalkjha

    Yes, issue is fixed and it can be closed. Thanks.

  10. oalfroukh commented on Jul 27, 2025

    @oalfroukh
    Author

    Hi,
    I confirm that I'm not able to reproduce the issue on v2.23.0, so I'm closing the issue.

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

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