Skip to content

nan_callbacks.h:55:23: error: ‘AccessorSignature’ is not a member of ‘v8’ #942

Closed

Description

@Abdullah-Albinali

i am not sure i am posting this in the correct place, but i am facing the below issue and i am not sure how to proceed further on this.

appreciate any push in the right direction.

⠙ Building module: node-pty, Completed: 0In file included from ../../nan/nan.h:180,
                 from ../src/unix/pty.cc:20:
../../nan/nan_callbacks.h:55:23: error: ‘AccessorSignature’ is not a member of ‘v8’
   55 | typedef v8::Local<v8::AccessorSignature> Sig;
      |                       ^~~~~~~~~~~~~~~~~
../../nan/nan_callbacks.h:55:40: error: template argument 1 is invalid
   55 | typedef v8::Local<v8::AccessorSignature> Sig;
      | 

Activity

  1. westlakem commented on Aug 12, 2022

    @westlakem

    Same problem when trying to compile for Electron v20

    Building module: fsuipc, Completed: 0D:\devl\electron\fsecosystem\node_modules\nan\nan_callbacks.h(55,23): error C2039: 'AccessorSignature': is not a member of 'v8' [D:\devl\electron\fsecosystem\node_modules\fsuipc\build\fsuipc.vcxproj]
    C:\Users\Matt\.electron-gyp\20.0.1\include\node\v8.h(71): message : see declaration of 'v8' [D:\devl\electron\fsecosystem\node_modules\fsuipc\build\fsuipc.vcxproj]
    
  2. nikitakot commented on Aug 17, 2022

    @nikitakot

    same problem, using electron-rebuild to rebuild a native module which uses nan for Electron v20 and getting nan_callbacks.h(55,23): error C2039: 'AccessorSignature': is not a member of 'v8' and similar errors related to AccessorSignature

    "electron": "20.0.2" (V8 10.4, Node.js 16.15.0, Chromium 104)
    "nan": "2.16.0
    "electron-rebuild": "3.2.9"
    
  3. RaisinTen commented on Aug 18, 2022

    @RaisinTen
    Member

    A PR has already been sent to fix this - #941.

  4. chouzz commented on Aug 19, 2022

    @chouzz

    A PR has already been sent to fix this - #941.

    Confirmed, this PR fix my problem when rebuild electron with node-pty.

  5. Abdullah-Albinali commented on Aug 19, 2022

    @Abdullah-Albinali
    Author

    confirmed as well! thank!

  6. RaisinTen commented on Aug 19, 2022

    @RaisinTen
    Member

    Let's keep this open for now. It will get closed automatically when the PR lands!

  7. alejandroclaro commented on Oct 7, 2022

    @alejandroclaro

    In case someone is looking for workarounds until this is fixed, take a look to: electron/electron#35193

  8. RichardFoss commented on Oct 7, 2022

    @RichardFoss

    I am using a midi package. Recently I updated to node v 18.10.0 and nw v0.69.1. When I rebuild:
    nw-gyp rebuild --target=0.69.1 --arch=x64
    I get:
    ../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
    typedef v8::Localv8::AccessorSignature Sig;

    I have looked at various resolutions to the issue in this thread. I have tried putting this into the midi package.json:
    "overrides": {
    "nan": "github:jkleinsc/nan#remove_accessor_signature"
    },
    But still get the same message. Any suggestions?
    
  9. alejandroclaro commented on Oct 7, 2022

    @alejandroclaro

    @RichardFoss I didn't follow that approach and it works in my case. This is what I did:

    1. Add a resolution into the package.json (in the root of the repository if it's a monorepo):
      image

    2. Add patch-package package to apply a patch after npm install:

      "scripts": {
        "postinstall": "patch-package || true",
      },
      "devDependencies": {
        "patch-package": "^6.4.7",
      },
    1. Create or add the following patch (patches/nan+2.16.0.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;
  10. RichardFoss commented on Oct 8, 2022

    @RichardFoss

    Thanks for this comprehensive comment! I have gone down a different path now after feedback from the midi group. I am using an updated midi implementation - read here - https://github.com/julusian/node-midi#readme, and this is working well for me! The nan issue is not present with this implementation.

  11. added a commit that references this issue on Dec 30, 2022
  12. zzikkzzakk commented on Feb 1, 2023

    @zzikkzzakk

    This solved it for me
    https://stackoverflow.com/questions/61657685/npm-doesnt-install-node-gyp-error-class-v8object-has-no-member-named-for

    npm install -g npm-check-updates
    npm-check-updates -u
    npm install
    

    It just upgrades the libraries in package.json to the latest versions

  13. idemax commented on Apr 5, 2023

    @idemax

    same here :/

  14. StepanPetei commented on May 1, 2023

    @StepanPetei

    @RichardFoss I didn't follow that approach and it works in my case. This is what I did:

    1. Add a resolution into the package.json (in the root of the repository if it's a monorepo):
      image
    2. Add patch-package package to apply a patch after npm install:
      "scripts": {
        "postinstall": "patch-package || true",
      },
      "devDependencies": {
        "patch-package": "^6.4.7",
      },
    1. Create or add the following patch (patches/nan+2.16.0.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;

    how to add this patch and where?

  15. added a commit that references this issue on Jun 6, 2023
  16. jaroslaw-weber commented on Sep 21, 2023

    @jaroslaw-weber

    still happens when tried to move to pnpm...

  17. tuwilof commented on Oct 12, 2023

    @tuwilof

    It works for me if I use yarn

    yarn add nan 
    
  18. added a commit that references this issue on Nov 7, 2023
  19. added a commit that references this issue on Nov 7, 2023
  20. Cheprer commented on Nov 17, 2023

    @Cheprer

    If someone is wondering Node.JS 20 build failure use similar approach as above with updated version since some package did not update it on their latest like: sharp

      "resolutions": {
        "nan": "2.18.0"
      },
    
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