node-diskusage
node-diskusage copied to clipboard
Make module context-aware in Node 10+
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: https://github.com/electron/electron/issues/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.
@henhouse thanks mate. I needed that fix for my Electron app. Merged this PR in my fork.
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