-
-
Notifications
You must be signed in to change notification settings - Fork 529
Description
Description
Compiling a minimal NAN addon against Electron 41.0.0 (which bundles Node 24.14.0 and V8 14.6) triggers build failures inside nan.h when the following methods in AsyncResource attempts to use V8’s legacy untagged internal‑field pointer APIs. V8 14.x removed the following untagged overloads:
GetAlignedPointerFromInternalField(int)
SetAlignedPointerInInternalField(int, void*)
V8 now only exposes the tagged versions requiring an EmbedderDataTypeTag, in the v8::Object API for V8 14.x. The compiler (MSVC in my case) throws exception when compiled against electron 41.0.0 and node 24.14.0. This seems to be due to the recent v8 upgrade.
(ClCompile target) ->
...\node_modules\nan\nan.h(822,20): error C2661: 'v8::Object::GetAlignedPointerFromInternalField': no overloaded function takes 1 arguments [...\build\hello.vcxproj]
...\node_modules\nan\nan.h(829,13): error C2660: 'v8::Object::SetAlignedPointerInInternalField': function does not take 2 arguments [...\build\hello.vcxproj]
These failures do not occur when compiling against standard Node builds using older V8 versions. They occur only when building against Electron 41+ because its toolchain exposes the newer V8 APIs where the untagged overloads have been removed. Here is the update in node
Steps to Reproduce
Here is a repo that contains a minimal example reproducing the issue
Suggested Fix
I have a small patch that detects V8 ≥ 14 using V8_MAJOR_VERSION and switches to the tagged overloads but reserves the legacy API for older Node versions. Once maintainers confirm the desired direction, I can open a PR with the changes. Thank you!