Native node module not loading even despite electron-rebuild


#1

I was just trying to incorporate notifications in my app and added the native node module macos-notification-state.

After installing the module, the app does not load and throws the following error:

App threw an error during load
Error: The module '/Users/shashi/projects/trici-atman-desktop/node_modules/macos-notification-state/build/Release/notificationstate.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 54. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at bindings (/Users/shashi/projects/trici-atman-desktop/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/Users/shashi/projects/trici-atman-desktop/node_modules/macos-notification-state/lib/index.js:1:189)

I installed electron-rebuild and have rebuilt all the native node modules and that happens without any errors. But when I run the app, I still get the above error, despite having rebuilt using electron rebuilt. Any ideas how to resolve this?


#2

electron-rebuild works. The script to rebuild was running some other command and not electron-rebuild.