Skip to content

Make module context-aware in Node 10+ - #58

Open
henhouse wants to merge 1 commit into
jduncanator:masterfrom
henhouse:context-aware-fix
Open

Make module context-aware in Node 10+#58
henhouse wants to merge 1 commit into
jduncanator:masterfrom
henhouse:context-aware-fix

Conversation

@henhouse

Copy link
Copy Markdown

It is no longer possible to use this module in newer versions of Electron due to native modules being required to be context aware. The ability to disable this requirement (which is deprecated since Electron 10), is removed in the next version (14). See: electron/electron#18397

Luckily, it is rather easy to use NAN to make the module context aware, if the Node version is high enough to support it. This change allows this module to be used on older and newer versions of Electron and Node.

@aleksey-hoffman

Copy link
Copy Markdown

@henhouse thanks mate. I needed that fix for my Electron app. Merged this PR in my fork.

@aleksey-hoffman

Copy link
Copy Markdown

I found a problem with it though. It's not working on some versions of Electron:

After upgrading to Electron 13.2.2:

npm install
• electron-builder version=22.10.5
• rebuilding native dependencies dependencies=diskusage@1.1.3, xxhash-addon@1.4.0 platform=win32 arch=x64
⨯ cannot execute cause=exit status 1
errorOut=npm ERR! code 1
npm ERR! path E:\test-project\node_modules\diskusage
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! main.cpp
npm ERR! C:\Users\alex\.electron-gyp\13.2.2\include\node\node.h(67,10): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [E:\test-project\node_modules\diskusage\build\diskusage.vcxproj]

This module seems to be working without problems:
https://github.com/blagoev/node-diskusage

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@henhouse@aleksey-hoffman