Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[node 20] Compilation error on nan #273

Closed
yosiat opened this issue Dec 3, 2023 · 9 comments
Closed

[node 20] Compilation error on nan #273

yosiat opened this issue Dec 3, 2023 · 9 comments
Assignees

Comments

@yosiat
Copy link

yosiat commented Dec 3, 2023

Hi,

I am trying to upgrade to node 20 (from 16) and I see this compilation error:

npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]

npm ERR! In file included from ../../nan/nan.h:178,

npm ERR!                  from ../bindings/profiler.cc:19:

npm ERR! ../../nan/nan_callbacks.h:55:23: error: 'AccessorSignature' is not a member of 'v8'

npm ERR!    55 | typedef v8::Local<v8::AccessorSignature> Sig;

npm ERR!       |                       ^~~~~~~~~~~~~~~~~

npm ERR! ../../nan/nan_callbacks.h:55:40: error: template argument 1 is invalid

npm ERR!    55 | typedef v8::Local<v8::AccessorSignature> Sig;

npm ERR!       |                                        ^

npm ERR! ../../nan/nan.h: In function 'bool Nan::IdleNotification(int)':

npm ERR! ../../nan/nan.h:684:63: warning: 'bool v8::Isolate::IdleNotificationDeadline(double)' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]

npm ERR!   684 |     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(

npm ERR!       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

npm ERR!   685 |         idle_time_in_ms * 0.001);

npm ERR!       |         ~~~~~~~~~~~~~~~~~~~~~~~~                               

npm ERR! In file included from /home/node/.cache/node-gyp/20.10.0/include/node/v8-initialization.h:13,

npm ERR!                  from /home/node/.cache/node-gyp/20.10.0/include/node/v8.h:34,

npm ERR!                  from /home/node/.cache/node-gyp/20.10.0/include/node/node.h:73,

npm ERR!                  from ../../nan/nan.h:58:

npm ERR! /home/node/.cache/node-gyp/20.10.0/include/node/v8-isolate.h:1293:8: note: declared here

npm ERR!  1293 |   bool IdleNotificationDeadline(double deadline_in_seconds);

npm ERR!       |        ^~~~~~~~~~~~~~~~~~~~~~~~

npm ERR! ../../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)':

npm ERR! ../../nan/nan.h:2544:19: error: no matching function for call to 'v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>&, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::Object>&, v8::AccessControl&, v8::PropertyAttribute&, Nan::imp::Sig&)'

npm ERR!  2544 |   tpl->SetAccessor(

npm ERR!       |   ~~~~~~~~~~~~~~~~^

npm ERR!  2545 |       name

npm ERR!       |       ~~~~         

npm ERR!  2546 |     , getter_

npm ERR!       |     ~~~~~~~~~      

npm ERR!  2547 |     , setter_

npm ERR!       |     ~~~~~~~~~      

npm ERR!  2548 |     , obj

npm ERR!       |     ~~~~~          

npm ERR!  2549 |     , settings

npm ERR!       |     ~~~~~~~~~~     

npm ERR!  2550 |     , attribute

npm ERR!       |     ~~~~~~~~~~~    

npm ERR!  2551 |     , signature);

npm ERR!       |     ~~~~~~~~~~~~   

npm ERR! In file included from /home/node/.cache/node-gyp/20.10.0/include/node/v8-function.h:15,

npm ERR!                  from /home/node/.cache/node-gyp/20.10.0/include/node/v8.h:33:

npm ERR! /home/node/.cache/node-gyp/20.10.0/include/node/v8-template.h:809:8: note: candidate: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, v8::AccessorGetterCallback, v8::AccessorSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)'

npm ERR!   809 |   void SetAccessor(

npm ERR!       |        ^~~~~~~~~~~

npm ERR! /home/node/.cache/node-gyp/20.10.0/include/node/v8-template.h:814:22: note:   no known conversion for argument 7 from 'Nan::imp::Sig' {aka 'int'} to 'v8::SideEffectType'

npm ERR!   814 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,

npm ERR!       |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

npm ERR! /home/node/.cache/node-gyp/20.10.0/include/node/v8-template.h:816:8: note: candidate: 'void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)'

npm ERR!   816 |   void SetAccessor(

npm ERR!       |        ^~~~~~~~~~~

npm ERR! /home/node/.cache/node-gyp/20.10.0/include/node/v8-template.h:821:22: note:   no known conversion for argument 7 from 'Nan::imp::Sig' {aka 'int'} to 'v8::SideEffectType'

npm ERR!   821 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,

npm ERR!       |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

npm ERR! make: *** [pprof.target.mk:115: Release/obj.target/pprof/bindings/profiler.o] Error 1

npm ERR! gyp ERR! build error 

This issue looks like it's fixed in nan 2.17.0 - https://github.com/nodejs/nan/blob/main/CHANGELOG.md#2170-oct-10-2022

Is it possible to upgrade this dependency?

@aabmass
Copy link
Member

aabmass commented Dec 5, 2023

Thanks for flagging this. It's actually fixed on main, we just need a release.

@aabmass aabmass self-assigned this Dec 5, 2023
@yosiat
Copy link
Author

yosiat commented Dec 7, 2023

Thanks @aabmass , I saw it was released as 3.3.0 which is deprecated release.

@aabmass
Copy link
Member

aabmass commented Dec 13, 2023

Yes, I deprecated that one. IIRC it contained accidental breaking changes which should have been a major bump. I made a patch release instead to fix it

@yosiat
Copy link
Author

yosiat commented Jan 28, 2024

hey @aabmass is there any update on this one?

we are blocked on node 18 because of this, and the fix should be simple (unless I am missing something) - change nan from 2.14.0 to 2.17.0

@aabmass
Copy link
Member

aabmass commented Jan 31, 2024

@yosiat I'm working on a release right now. However, after checking what was published in pprof@3.2.1, I notice the version of nan has a carat dependency:

"nan": "^2.14.0",

IOW, you should be able to install it in Node 20 today. You might have an older version of nan in your package-lock.json. Please try upgrading nan–I tested it in a fresh repo and it works.

@yosiat
Copy link
Author

yosiat commented Feb 1, 2024

@aabmass I agree with you that carat should work here, but it doesn't work as expected in my project.

It keeps installing nan v2.15.0 (and there is no other module depending on it except pprof), the only trick that worked is npm install nan and then npm uninstall nan, which is a bit weird one.

@aabmass
Copy link
Member

aabmass commented Feb 2, 2024

@yosiat I'm guessing it was probably stale from either your package-lock.json or in node_modules directory

@aabmass
Copy link
Member

aabmass commented Feb 2, 2024

Just published v4.0.0

@aabmass aabmass closed this as completed Feb 2, 2024
@yosiat
Copy link
Author

yosiat commented Feb 3, 2024

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants