Skip to content

[Bug]: Native modules that include nan.h fail to build on electron 20 #35193

Closed

Description

@npezza93

Preflight Checklist

Electron Version

20.0.0

What operating system are you using?

macOS

Operating System Version

monterey

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

Latest v19

Expected Behavior

Native modules to install correctly

Actual Behavior

I've seen this behavior on two different node modules when they #include <nan.h> so it seems independent from the implementations in the modules. It seems to be triggered by just including nan.h when electron-gyp goes to build the module. Are modules no longer allowed to include nan.h or is this a bug inside electron? Thanks!

I'll also note both the modules I mention are pointed to nan v2.16.0

image

Testcase Gist URL

Here is an example package.json. Running npm i triggers the aforementioned error.

{                                                                                                                                   
  "scripts": {                                                                                                                      
    "postinstall": "electron-rebuild -f -w node-pty"                                                                                
  },                                                                                                                                
  "dependencies": {                                                                                                                 
    "node-pty": "0.11.0-beta20"                                                                                                     
  },                                                                                                                                
  "devDependencies": {                                                                                                              
    "electron": "^20.0.0",                                                                                                          
    "electron-rebuild": "^3.2.9"                                                                                                    
  }                                                                                                                                 
}

Additional Information

No response

Activity

  1. changed the title [-][Bug]: [/-] [+][Bug]: Native module that include nan.h fail to build on electron 20[/+] on Aug 3, 2022
  2. changed the title [-][Bug]: Native module that include nan.h fail to build on electron 20[/-] [+][Bug]: Native modules that include nan.h fail to build on electron 20[/+] on Aug 3, 2022
  3. codebytere commented on Aug 3, 2022

    @codebytere
    Member
  4. VerteDinde commented on Aug 3, 2022

    @VerteDinde
    Member

    Shoot, I know what this is 😕 Sorry @npezza93, here's what's happening - AccessorSignatures was deprecated in Chromiuim in this CL, which was included in Electron 20. We've made an upstream PR to similarly remove AccessorSignatures from nan itself: nodejs/nan#941 However, it looks like that PR has stalled.

    The presence of the deprecated AccessorSignatures specifically is why your module is failing to build. We'll need to get that upstream PR merged and a new version of nan released in order to fix the issue.

    Can you try adding this to your package's package.json and see if it resolves the issue for you temporarily?:

      "resolutions": {
        "nan": "github:jkleinsc/nan#remove_accessor_signature"
      },
    

    I'll see if we can find a more suitable workaround for this while we wait for the upstream PR to land, so devs don't have to use this hack. 🙇‍♀️ Thanks for reporting this!

  5. added
    status/confirmed
    on Aug 3, 2022
  6. npezza93 commented on Aug 3, 2022

    @npezza93
    Author

    Hey @VerteDinde!

    That resolution may have fixed it. There are circumstances where I can get the attached error to show up, though which is different. Not sure if it is related or a different issue. If I use electron-rebuild, that resolution seems to fix it, but if I use electron-builder with ./node_modules/.bin/electron-builder install-app-deps this trigger happens. I can give a package.json that's reproducible if that will help.

    image

  7. VerteDinde commented on Aug 3, 2022

    @VerteDinde
    Member

    @npezza93 A package.json or toy app repro would be great, thanks!

    electron-builder is run by a different maintainer team, so if the issue is only occurring there and not in electron-rebuild/electron-forge, we may have to file another issue with them so it's on their radar 🙂 But happy to work you and them on getting that fix in.

  8. moved this to Blocks Stable in 20-x-yon Aug 3, 2022
  9. npezza93 commented on Aug 3, 2022

    @npezza93
    Author

    @VerteDinde No worries! Here is an example package.json using electron-rebuild.

    {                                                                                                                                   
      "scripts": {                                                                                                                      
        "postinstall": "electron-rebuild -f -w keyboard-layout"                                                                                
      },                                                                                                                                
      "dependencies": {                                                                                                                 
        "keyboard-layout": "^2.0.17"                                                                               
      },
      "resolutions": {
        "nan": "github:jkleinsc/nan#remove_accessor_signature"
      },                                                                                                                                
      "devDependencies": {                                                                                                              
        "electron": "^20.0.0",                                                                                                          
        "electron-rebuild": "^3.2.9"                                                                                                    
      }                                                                                                                                 
    }
  10. namespace-github commented on Aug 5, 2022

    @namespace-github

    We have the same Problem in electron 20 with "nan"...

    node_modules\nan\nan_callbacks.h(55,23): error C2039: "AccessorSignature" ist kein Member von "v8"
    node_modules\nan\nan_callbacks.h(55,40): error C2065: "AccessorSignature": nichtdeklarierter Bezeichner
    node_modules\nan\nan_callbacks.h(55,13): error C2923: "v8::Local": "AccessorSignature" ist kein gültiges Vorlage-Typargument
    node_modules\nan\nan.h(2546,6): error C2664: "void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>,...
    ...
    

    ...and also "CreationContext" WiseLibs/better-sqlite3#858

    "CreationContext" is no member of "v8::Object"

    void Init(v8::Local<v8::Object> exports)
    {
        v8::Local<v8::Context> context = exports->CreationContext();
  11. moved this from Blocks Stable to Fixed for Next Release in 20-x-yon Aug 10, 2022
  12. 8 remaining items

  13. DAC324 commented on Sep 24, 2022

    @DAC324

    Is this error I am experiencing (see below) related, or is it a different issue?
    Reason for asking: The proposed fixes to binding.gyp and package.json do not seem to have any effect here.

    In file included from ../src/bindings/point-wrapper.h:4,
                     from ../src/bindings/point-wrapper.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    In file included from ../src/bindings/marker-index-wrapper.h:1,
                     from ../src/bindings/bindings.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    ../src/bindings/bindings.cc: At global scope:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:890:7: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
      890 |       (node::addon_register_func) (regfunc),                          \
          |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:924:3: note: in expansion of macro 'NODE_MODULE_X'
      924 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
          |   ^~~~~~~~~~~~~
    ../src/bindings/bindings.cc:24:1: note: in expansion of macro 'NODE_MODULE'
       24 | NODE_MODULE(superstring, Init)
          | ^~~~~~~~~~~
    In file included from ../src/bindings/noop.h:3,
                     from ../src/bindings/patch-wrapper.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    In file included from ../src/bindings/marker-index-wrapper.h:1,
                     from ../src/bindings/marker-index-wrapper.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    ../src/bindings/marker-index-wrapper.cc: In static member function 'static v8::Local<v8::Array> MarkerIndexWrapper::marker_ids_vector_to_js(const std::vector<unsigned int>&)':
    ../src/bindings/marker-index-wrapper.cc:116:18: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
      116 |     js_array->Set(context, i, Nan::New<Integer>(marker_ids[i]));
          |     ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-array-buffer.h:13,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:24:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-object.h:247:37: note: declared here
      247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
          |                                     ^~~
    ../src/bindings/marker-index-wrapper.cc: In static member function 'static v8::Local<v8::Object> MarkerIndexWrapper::snapshot_to_js(const std::unordered_map<unsigned int, Range>&)':
    ../src/bindings/marker-index-wrapper.cc:127:15: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
      127 |     range->Set(context, Nan::New(start_string), PointWrapper::from_point(pair.second.start));
          |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-object.h:244:37: note: declared here
      244 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    ../src/bindings/marker-index-wrapper.cc:128:15: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
      128 |     range->Set(context, Nan::New(end_string), PointWrapper::from_point(pair.second.end));
          |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-object.h:244:37: note: declared here
      244 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    ../src/bindings/marker-index-wrapper.cc:129:23: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
      129 |     result_object->Set(context, Nan::New<Integer>(pair.first), range);
          |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-object.h:244:37: note: declared here
      244 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
          |                                     ^~~
    In file included from ../src/bindings/range-wrapper.h:4,
                     from ../src/bindings/range-wrapper.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    In file included from ../src/bindings/text-buffer-wrapper.h:4,
                     from ../src/bindings/text-buffer-wrapper.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    ../src/bindings/text-buffer-wrapper.cc: In function 'v8::Local<v8::Value> encode_ranges(const std::vector<Range>&)':
    ../src/bindings/text-buffer-wrapper.cc:390:23: error: 'class v8::ArrayBuffer' has no member named 'GetContents'
      390 |   auto data = buffer->GetContents().Data();
          |                       ^~~~~~~~~~~
    ../src/bindings/text-buffer-wrapper.cc: In member function 'virtual void TextBufferWrapper::find_words_with_subsequence_in_range(const Nan::FunctionCallbackInfo<v8::Value>&)::FindWordsWithSubsequenceInRangeWorker::HandleOKCallback()':
    ../src/bindings/text-buffer-wrapper.cc:614:81: error: 'class v8::ArrayBuffer' has no member named 'GetContents'
      614 |       uint32_t *positions_data = reinterpret_cast<uint32_t *>(positions_buffer->GetContents().Data());
          |                                                                                 ^~~~~~~~~~~
    ../src/bindings/text-buffer-wrapper.cc: In static member function 'static void TextBufferWrapper::load(const Nan::FunctionCallbackInfo<v8::Value>&)':
    ../src/bindings/text-buffer-wrapper.cc:938:50: warning: 'v8::Local<v8::Context> v8::Object::CreationContext()' is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
      938 |     Nan::Call(callback, callback->CreationContext()->Global(), 2, argv);
          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~^~
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-array-buffer.h:13,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:24:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-object.h:598:18: note: declared here
      598 |   Local<Context> CreationContext();
          |                  ^~~~~~~~~~~~~~~
    ../src/bindings/text-buffer-wrapper.cc: In static member function 'static void TextBufferWrapper::base_text_matches_file(const Nan::FunctionCallbackInfo<v8::Value>&)':
    ../src/bindings/text-buffer-wrapper.cc:1042:50: warning: 'v8::Local<v8::Context> v8::Object::CreationContext()' is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
     1042 |     Nan::Call(callback, callback->CreationContext()->Global(), 2, argv);
          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~^~
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-object.h:598:18: note: declared here
      598 |   Local<Context> CreationContext();
          |                  ^~~~~~~~~~~~~~~
    make: *** [superstring.target.mk:129: Release/obj.target/superstring/src/bindings/text-buffer-wrapper.o] Error 1
    make: *** Waiting for unfinished jobs....
    In file included from ../src/bindings/text-buffer-wrapper.h:4,
                     from ../src/bindings/text-buffer-snapshot-wrapper.cc:2:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    In file included from ../src/bindings/string-conversion.h:5,
                     from ../src/bindings/string-conversion.cc:1:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    In file included from ../src/bindings/text-reader.h:4,
                     from ../src/bindings/text-reader.cc:2:
    ../../nan/nan.h: In function 'void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)':
    ../../nan/nan.h:2542:19: warning: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)' is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
     2542 |   tpl->SetAccessor(
          |   ~~~~~~~~~~~~~~~~^
     2543 |       name
          |       ~~~~         
     2544 |     , getter_
          |     ~~~~~~~~~      
     2545 |     , setter_
          |     ~~~~~~~~~      
     2546 |     , obj
          |     ~~~~~          
     2547 |     , settings
          |     ~~~~~~~~~~     
     2548 |     , attribute
          |     ~~~~~~~~~~~    
     2549 |     , signature);
          |     ~~~~~~~~~~~~   
    In file included from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-function.h:15,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8.h:33,
                     from /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/node.h:73,
                     from ../../nan/nan.h:56:
    /home/gerd/.atom/.node-gyp/.cache/node-gyp/18.9.0/include/node/v8-template.h:838:8: note: declared here
      838 |   void SetAccessor(
          |        ^~~~~~~~~~~
    gyp ERR! build error 
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/opt/.cache/yay/atom/atom/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    gyp ERR! System Linux 6.0.0-1-MANJARO
    gyp ERR! command "/opt/.cache/yay/atom/atom/apm/node_modules/atom-package-manager/bin/node" "/opt/.cache/yay/atom/atom/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /opt/.cache/yay/atom/atom/node_modules/github/node_modules/superstring
    gyp ERR! node -v v12.18.3
    gyp ERR! node-gyp -v v5.1.0
    gyp ERR! not ok 
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the [email protected] install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/gerd/.atom/.apm/_logs/2022-09-24T08_41_27_720Z-debug.log
    

    2022-09-24T08_41_27_720Z-debug.log

  14. alejandroclaro commented on Oct 7, 2022

    @alejandroclaro

    I was dealing with this problem a few days ago. For those trying to solve, there are multiple things related that could be confusing and all need to be addresses:

    1. Make sure you have NodeJS >=16.0.0 installed globally. There is a recent change that introduce a validation about the version of node-gyp. In packages like electron-builder, when they are trying to rebuild native dependencies, don't find the node-gyp installed locally in the repository. The node-gyp installed by nodejs 14.x is too old (5.x).

    You can also upgrade node-gyp, or change the npm/yarn configuration to other place with

    npm set node_gyp <node-gyp.js path>
    1. Some packages need to compile with C++17 as standard. However, not all specify this explicitly and eletron-gyp sets C++14 by default.

    @deermichel look like had this issue.

    In my case, I had to patch (with patch-package) the bidding.gyp file in some packages to make this work. Something like this:

    +      'cflags': [ '-std=c++17' ],
    +      'cflags_cc': [ '-std=c++17' ],
    1. There is an issue with the change in chromium/electron that is incompatible with nan.

    For this you could do what @SocketByte recommended, but it's also possible, and less prompt to issues, to force the resolution to nan 2.16 and apply a patch with patch-package until the problem is fixed. I'm sharing there the patch:

    diff --git a/node_modules/nan/nan.h b/node_modules/nan/nan.h
    index 9e7c59e..0326246 100644
    --- a/node_modules/nan/nan.h
    +++ b/node_modules/nan/nan.h
    @@ -2516,8 +2516,7 @@ inline void SetAccessor(
       , SetterCallback setter = 0
       , v8::Local<v8::Value> data = v8::Local<v8::Value>()
       , v8::AccessControl settings = v8::DEFAULT
    -  , v8::PropertyAttribute attribute = v8::None
    -  , imp::Sig signature = imp::Sig()) {
    +  , v8::PropertyAttribute attribute = v8::None) {
       HandleScope scope;
     
       imp::NativeGetter getter_ =
    @@ -2550,9 +2549,6 @@ inline void SetAccessor(
         , obj
         , settings
         , attribute
    -#if (NODE_MODULE_VERSION < NODE_18_0_MODULE_VERSION)
    -    , signature
    -#endif
       );
     }
     
    diff --git a/node_modules/nan/nan_callbacks.h b/node_modules/nan/nan_callbacks.h
    index 53ede84..ea81e45 100644
    --- a/node_modules/nan/nan_callbacks.h
    +++ b/node_modules/nan/nan_callbacks.h
    @@ -52,8 +52,6 @@ typedef void(*IndexQueryCallback)(
         const PropertyCallbackInfo<v8::Integer>&);
     
     namespace imp {
    -typedef v8::Local<v8::AccessorSignature> Sig;
    -
     static const int kDataIndex =                    0;
     
     static const int kFunctionIndex =                1;
  15. miniak commented on Oct 10, 2022

    @miniak
    Contributor
  16. RaisinTen commented on Oct 11, 2022

    @RaisinTen
    Contributor

    I can confirm that this issue is fixed in the latest nan version, so I'm closing this issue. Feel free to let me know if anyone is still facing this, then I will reopen it. Thanks everyone! 🎉

  17. christhomas commented on Dec 10, 2022

    @christhomas

    I'm having this exact same problem today, I upgraded my yarn packages and checked the version it's installing and it's "[email protected]"

    This fixes the problem for me

    "resolutions": {
        "nan": "github:tec27/nan#remove_accessor_signature"
    }
    
  18. verhovsky commented on Mar 17, 2023

    @verhovsky

    @RaisinTen please re-open the issue, I'm still getting this (actually I'm getting the error in #35244 but it's apparently a duplicate of this one) with nan 2.17.0 on Ubuntu.

    You should be able to reproduce it like this:

    git clone --recurse-submodules https://github.com/curlconverter/node-tree-sitter.git
    cd node-tree-sitter
    git checkout 3e0b4ea7a451c3600f018c44a4be256e86563b4f
    npm install
    npx prebuild -r electron -t 20.0.0
    

    Here is the failure on GitHub Actions with Ubuntu 22.04 and Node 16:

    https://github.com/curlconverter/node-tree-sitter/actions/runs/4444438174/jobs/7802716003

    Here is the failure on GitHub Actions with Ubuntu 22.04 and Node 18:

    https://github.com/curlconverter/node-tree-sitter/actions/runs/4444652880/jobs/7806116600

    notice that macOS works and Windows fails for a different reason.

    On my macOS with Node 19 I also don't get this error.

  19. ianhattendorf commented on Mar 17, 2023

    @ianhattendorf

    @verhovsky the linux failure indicates you're not compiling for C++17 or later (error: ‘is_lvalue_reference_v’ is not a member of ‘std’, is_lvalue_reference_v was added in C++17). Looks like you're using cflags to set the C++ version, you should be using cflags_cc instead (https://github.com/curlconverter/node-tree-sitter/blob/3e0b4ea7a451c3600f018c44a4be256e86563b4f/binding.gyp#L30).

    The Windows failure doesn't look familiar off the top of my head, but might be the same issue. You could try something like the following inside an "OS=='win'" condition (you can probably search for msvs_settings to find examples):

    "msvs_settings": {
      "VCCLCompilerTool": {
        "AdditionalOptions": [
          "/std:c++17"
        ]
      }
    },
    

    These are just examples, based on your build system you might need to tweak them. If still supporting older Electron versions, you might need to make the C++ version configurable.

  20. verhovsky commented on Mar 17, 2023

    @verhovsky

    @ianhattendorf thank you, it works on Ubuntu now.

    Your suggestion for Windows didn't help. I also tried this, as suggested here, but it didn't help either and I got a bizarre error

    prebuild info build Uploading 5 prebuilds(s) to GitHub releases
    prebuild ERR! build SyntaxError
    prebuild ERR! build     at BufferList._callback (D:\a\node-tree-sitter\node-tree-sitter\node_modules\jsonist\jsonist.js:52:52)
    prebuild ERR! build     at BufferList.end (D:\a\node-tree-sitter\node-tree-sitter\node_modules\bl\bl.js:113:10)
    prebuild ERR! build     at DuplexWrapper.onend (D:\a\node-tree-sitter\node-tree-sitter\node_modules\duplexer2\node_modules\readable-stream\lib\_stream_readable.js:537:10)
    prebuild ERR! build     at Object.onceWrapper (node:events:627:28)
    prebuild ERR! build     at DuplexWrapper.emit (node:events:525:35)
    prebuild ERR! build     at D:\a\node-tree-sitter\node-tree-sitter\node_modules\duplexer2\node_modules\readable-stream\lib\_stream_readable.js:934:16
    prebuild ERR! build     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
    Error: Process completed with exit code 1.
    

    when building for Node, whereas with the Windows changes in your suggestion it was able to build for Node and failed on Electron. I wanted Windows to work but I'm over it, thanks for the help.

  21. idemax commented on Apr 5, 2023

    @idemax

    Was/am facing similar issues as well. We don't use yarn, just npm, so I ended up trying:

      "overrides": {
        "nan": "github:jkleinsc/nan#remove_accessor_signature"
      },

    in package.json and it worked well. Will continue following this issue for updates on things. Thanks for all of the support and work!

    Update 9/21: the GitHub/git branch the above is pointing to no longer exists. It sounds like github:tec27/nan#remove_accessor_signature is a good recreation of github:jkleinsc/nan#remove_accessor_signature. That said, I encourage everyone to actually look at the branch you choose to install. The person who owns the branch can commit whatever code they want. So make sure to verify you are installing something safe, whatever it is you choose to install. Alternatively you can fork nan and recreate the original branch yourself (this PR shows what the changes were) so things are more in your control.

    thanks!!!!!!

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

    20-x-ybug 🪲platform/macOSstatus/confirmed

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions