You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nan::SetAccessor() deprecation warning with V8 10.1 and nan 2.15.0 #936
../../../../node_modules/nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)’:
../../../../node_modules/nan/nan.h:2551:16: 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]
2551 | , signature);
| ^
In file included from /home/foo/.cache/node-gyp/18.0.0/include/node/v8-function.h:15,
from /home/foo/.cache/node-gyp/18.0.0/include/node/v8.h:33,
from /home/foo/.cache/node-gyp/18.0.0/include/node/node.h:63,
from ../src/binding.cc:13:
/home/foo/.cache/node-gyp/18.0.0/include/node/v8-template.h:838:8: note: declared here
838 | void SetAccessor(
| ^~~~~~~~~~~
changed the title [-]`Nan::SetAccessor()` warning with V8 10.1 and nan 2.15.0[/-][+]`Nan::SetAccessor()` deprecation warning with V8 10.1 and nan 2.15.0[/+]on Apr 20, 2022
../node_modules/nan/nan.h:2548:8: error: no matching member function for call to 'SetAccessor'
tpl->SetAccessor(
~~~~~^~~~~~~~~~~
/Users/danielweck/Library/Caches/node-gyp/29.0.0/include/node/v8-template.h:806:8: note: candidate function not viable: no known conversion from 'v8::AccessControl' to 'PropertyAttribute' for 5th argument
void SetAccessor(
^
/Users/danielweck/Library/Caches/node-gyp/29.0.0/include/node/v8-template.h:800:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
void SetAccessor(
I am getting a fatal compiler error with NAN 2.18.0 and Electron 29 / NodeJS 20, see my message above #936 (comment)
My current workaround is to comment out all the setAccessor functions from the postinstall script in my package.json (my project doesn't use these functions):
I can confirm this issue persists. It's not just a warning. It throws an error now, as @danielweck mentioned.
Create an empty folder and create this package.json:
I can confirm, I have the same issue. Nan is not compatible with Electron 29 / Node 20. As a temporary workaround you can use following in your package.json:
Activity
[-]`Nan::SetAccessor()` warning with V8 10.1 and nan 2.15.0[/-][+]`Nan::SetAccessor()` deprecation warning with V8 10.1 and nan 2.15.0[/+]mkrufky commentedon Apr 24, 2022
@mscdex Can you confirm that this is resolved in the main branch?
alejandroclaro commentedon Oct 7, 2022
There is now a similar problem with Electron >= 20
see: electron/electron#35193
danielweck commentedon Feb 21, 2024
Electron29 / NodeJS 20 breakage:
mscdex commentedon Feb 21, 2024
Looks like this was fixed in 2.17.0.
danielweck commentedon Feb 21, 2024
I am getting a fatal compiler error with NAN
2.18.0and Electron29/ NodeJS20, see my message above #936 (comment)My current workaround is to comment out all the
setAccessorfunctions from thepostinstallscript in mypackage.json(my project doesn't use these functions):nan/nan.h
Lines 2514 to 2655 in e14bdcd
danielweck commentedon Feb 21, 2024
PS: a while back somebody ended-up forking NAN to remove breaking function signatures:
electron/electron#35193 (comment)
I personally use the official NAN NPM package and I
sedintonan.hto inject comment markers/*+*/.j-stahl commentedon Feb 22, 2024
I can confirm this issue persists. It's not just a warning. It throws an error now, as @danielweck mentioned.
Create an empty folder and create this package.json:
Run
npm installand play around with the electron version. Electron < 29 will succeed.By the way: I took more than one day to figure out what is happening here. I am not pretty familar with all those dependency stuff.
ajgassner commentedon Feb 23, 2024
I can confirm, I have the same issue. Nan is not compatible with Electron 29 / Node 20. As a temporary workaround you can use following in your package.json:
Please note I just commented all the
SetAccessorthings as a dirty quick fix as I'm not familar with the V8 API.See #966
JasonYeMSFT commentedon Mar 1, 2024
Could this be a breaking change in node-gyp's header file?
In Electron 28.2.2's v8-template.h (you can find it at your_user_directory/.electron-gyp/Library/Caches/node-gyp/28.2.2/include/node)
In Electron 29.1.0's v8-template.h
It seems PropertyAttribute and AccessControl are not compatible given the error details:
Probably nan needs to adjust its signature to match the new signature.
fix: electron 29 workaround
fix: add workaround for electron 29
JCMais commentedon Dec 10, 2024
This is still happening and atm it is impossible to rebuild native addons on Electron v28
Edit: I was able to fix it by applying this patch: #982