Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make module context-aware in Node 10+ #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henhouse
Copy link

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

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

@aleksey-hoffman
Copy link

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  [email protected], [email protected] 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 free to 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