nan: Electron 33 broken
The latest NAN release works fine in Electron 32, but now fails with:
In file included from ../node_modules/nan/nan.h:3045:
../node_modules/nan/nan_scriptorigin.h:40:7: error: no matching constructor for initialization of 'v8::ScriptOrigin'
40 | v8::ScriptOrigin(v8::Isolate::GetCurrent()
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
41 | , name
| ~~~~~~
42 | , To<int32_t>(line).FromMaybe(0)) {}
../node_modules/nan/nan_scriptorigin.h:47:7: error: no matching constructor for initialization of 'v8::ScriptOrigin'
47 | v8::ScriptOrigin(v8::Isolate::GetCurrent()
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
48 | , name
| ~~~~~~
49 | , To<int32_t>(line).FromMaybe(0)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50 | , To<int32_t>(column).FromMaybe(0)) {}
../node_modules/nan/nan_scriptorigin.h:36:7: error: no matching constructor for initialization of 'v8::ScriptOrigin'
36 | v8::ScriptOrigin(v8::Isolate::GetCurrent(), name) {}
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/qwe/Library/Caches/node-gyp/33.0.0/include/node/v8-message.h:64:13: note: candidate constructor not viable: no known conversion from 'Isolate *' to 'Local<Value>' for 1st argument
64 | V8_INLINE ScriptOrigin(Local<Value> resource_name,
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/qwe/Library/Caches/node-gyp/33.0.0/include/node/v8-message.h:62:17: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
62 | class V8_EXPORT ScriptOrigin {
| ^~~~~~~~~~~~
/Users/qwe/Library/Caches/node-gyp/33.0.0/include/node/v8-message.h:62:17: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
62 | class V8_EXPORT ScriptOrigin {
| ^~~~~~~~~~~~
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (10 by maintainers)
Commits related to this issue
- patch nan package for electron 33 - see https://github.com/nodejs/nan/issues/978 — committed to glitter-ai/iohook by yuvalkarmi 2 years ago
- Bump to Electron 33. synchronous-socket depends on nan, which needs to be patched for Electron >= 33. For the complete discussion and a hotfix see: https://github.com/nodejs/nan/issues/978#issuecomm... — committed to atlas-engineer/cl-electron by aadcg 2 years ago
@danielweck this issue is still valid and should be open until a fix is landed
Not pretty, quick and dirty, but works in MacOS and Linux:
"postinstall": "sed 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/' ./node_modules/nan/nan.h > ./node_modules/nan/nan.h.new && mv ./node_modules/nan/nan.h.new ./node_modules/nan/nan.h"While the issue is solved in
nan v2.22.2postinstall overrides can be easily applied for sub dependencies. Here is a sample script from my repo:updatenan.jsElectron 33 moved to v8 13.0 while Node.js main is currently on v8 12.9, perhaps someone can create a working fork that addresses the problem? Unless by some miracle Node.js moves to v8 13.0 for its v23 release I do not think
nanwill address the issue themselves.