Repository navigation
Closed
Labels
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
20.0.0
What operating system are you using?
macOS
Operating System Version
monterey
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
Latest v19
Expected Behavior
Native modules to install correctly
Actual Behavior
I've seen this behavior on two different node modules when they #include <nan.h> so it seems independent from the implementations in the modules. It seems to be triggered by just including nan.h when electron-gyp goes to build the module. Are modules no longer allowed to include nan.h or is this a bug inside electron? Thanks!
I'll also note both the modules I mention are pointed to nan v2.16.0
Testcase Gist URL
Here is an example package.json. Running npm i triggers the aforementioned error.
{
"scripts": {
"postinstall": "electron-rebuild -f -w node-pty"
},
"dependencies": {
"node-pty": "0.11.0-beta20"
},
"devDependencies": {
"electron": "^20.0.0",
"electron-rebuild": "^3.2.9"
}
}Additional Information
No response
Reacted by Hendrik Schneider, Grzegorz Zdunek, namespace-github, Travis Collins, Justin Mayfield, mzanfirescu, Michael Manzinger, Peter Bridgman, Evan Gillogley, Michał Zarach and 5 more
Reacted by Memenymous, Justin Mayfield, Matthew Rayermann, mzanfirescu, Fabio Di Stasio, Evan Gillogley, Michał Zarach, Chris Marx, Ryan Ma, koji and 1 more
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsFixed for Next Release

Activity
[-][Bug]: [/-][+][Bug]: Native module that include nan.h fail to build on electron 20[/+][-][Bug]: Native module that include nan.h fail to build on electron 20[/-][+][Bug]: Native modules that include nan.h fail to build on electron 20[/+]codebytere commentedon Aug 3, 2022
cc @VerteDinde
VerteDinde commentedon Aug 3, 2022
Shoot, I know what this is 😕 Sorry @npezza93, here's what's happening - AccessorSignatures was deprecated in Chromiuim in this CL, which was included in Electron 20. We've made an upstream PR to similarly remove AccessorSignatures from nan itself: nodejs/nan#941 However, it looks like that PR has stalled.
The presence of the deprecated AccessorSignatures specifically is why your module is failing to build. We'll need to get that upstream PR merged and a new version of nan released in order to fix the issue.
Can you try adding this to your package's
package.jsonand see if it resolves the issue for you temporarily?:I'll see if we can find a more suitable workaround for this while we wait for the upstream PR to land, so devs don't have to use this hack. 🙇♀️ Thanks for reporting this!
npezza93 commentedon Aug 3, 2022
Hey @VerteDinde!
That resolution may have fixed it. There are circumstances where I can get the attached error to show up, though which is different. Not sure if it is related or a different issue. If I use electron-rebuild, that resolution seems to fix it, but if I use electron-builder with
./node_modules/.bin/electron-builder install-app-depsthis trigger happens. I can give a package.json that's reproducible if that will help.VerteDinde commentedon Aug 3, 2022
@npezza93 A package.json or toy app repro would be great, thanks!
electron-builder is run by a different maintainer team, so if the issue is only occurring there and not in electron-rebuild/electron-forge, we may have to file another issue with them so it's on their radar 🙂 But happy to work you and them on getting that fix in.
npezza93 commentedon Aug 3, 2022
@VerteDinde No worries! Here is an example package.json using electron-rebuild.
namespace-github commentedon Aug 5, 2022
We have the same Problem in electron 20 with "nan"...
...and also "CreationContext" WiseLibs/better-sqlite3#858
"CreationContext" is no member of "v8::Object"8 remaining items
DAC324 commentedon Sep 24, 2022
Is this error I am experiencing (see below) related, or is it a different issue?
Reason for asking: The proposed fixes to
binding.gypandpackage.jsondo not seem to have any effect here.2022-09-24T08_41_27_720Z-debug.log
alejandroclaro commentedon Oct 7, 2022
I was dealing with this problem a few days ago. For those trying to solve, there are multiple things related that could be confusing and all need to be addresses:
You can also upgrade node-gyp, or change the npm/yarn configuration to other place with
@deermichel look like had this issue.
In my case, I had to patch (with patch-package) the bidding.gyp file in some packages to make this work. Something like this:
For this you could do what @SocketByte recommended, but it's also possible, and less prompt to issues, to force the resolution to nan 2.16 and apply a patch with patch-package until the problem is fixed. I'm sharing there the patch:
miniak commentedon Oct 10, 2022
nodejs/nan#943 was merged and new version is released https://www.npmjs.com/package/nan/v/2.17.0
RaisinTen commentedon Oct 11, 2022
I can confirm that this issue is fixed in the latest nan version, so I'm closing this issue. Feel free to let me know if anyone is still facing this, then I will reopen it. Thanks everyone! 🎉
TF-255: Update build for Electron 20
TF-255: Update build for Electron 20
TF-255: Update build for Electron 20
christhomas commentedon Dec 10, 2022
I'm having this exact same problem today, I upgraded my yarn packages and checked the version it's installing and it's "[email protected]"
This fixes the problem for me
deps: Upgrade nan to v2.17.0
deps: Upgrade nan to v2.17.0
verhovsky commentedon Mar 17, 2023
@RaisinTen please re-open the issue, I'm still getting this (actually I'm getting the error in #35244 but it's apparently a duplicate of this one) with nan 2.17.0 on Ubuntu.
You should be able to reproduce it like this:
Here is the failure on GitHub Actions with Ubuntu 22.04 and Node 16:
https://github.com/curlconverter/node-tree-sitter/actions/runs/4444438174/jobs/7802716003
Here is the failure on GitHub Actions with Ubuntu 22.04 and Node 18:
https://github.com/curlconverter/node-tree-sitter/actions/runs/4444652880/jobs/7806116600
notice that macOS works and Windows fails for a different reason.
On my macOS with Node 19 I also don't get this error.
ianhattendorf commentedon Mar 17, 2023
@verhovsky the linux failure indicates you're not compiling for C++17 or later (
error: ‘is_lvalue_reference_v’ is not a member of ‘std’,is_lvalue_reference_vwas added in C++17). Looks like you're usingcflagsto set the C++ version, you should be usingcflags_ccinstead (https://github.com/curlconverter/node-tree-sitter/blob/3e0b4ea7a451c3600f018c44a4be256e86563b4f/binding.gyp#L30).The Windows failure doesn't look familiar off the top of my head, but might be the same issue. You could try something like the following inside an
"OS=='win'"condition (you can probably search formsvs_settingsto find examples):These are just examples, based on your build system you might need to tweak them. If still supporting older Electron versions, you might need to make the C++ version configurable.
verhovsky commentedon Mar 17, 2023
@ianhattendorf thank you, it works on Ubuntu now.
Your suggestion for Windows didn't help. I also tried this, as suggested here, but it didn't help either and I got a bizarre error
when building for Node, whereas with the Windows changes in your suggestion it was able to build for Node and failed on Electron. I wanted Windows to work but I'm over it, thanks for the help.
idemax commentedon Apr 5, 2023
thanks!!!!!!