Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use native Windows library in NodeJS

I am trying to write a simple Electron app that uses Windows native notifications. For this use I depend on electron-windows-interactive-notifications.

When I run npm install and after that electron-rebuild on my project I get:

App threw an error during load
Error: The specified module could not be found.
\\?\C:\Users\moro\projects\tw-en-ty\node_modules\electron-windows-interactive-notifications\build\Release\notifications_bindings.node
    at Error (native)
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:583:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at bindings (C:\Users\moro\projects\tw-en-ty\node_modules\bindings\bindings.js:76:44)

According to a NodeJS issue it can be a native dependency problem. When I examine notifications_bindings.node by dependencywalker I see following missing direct DLLs (among many missing nested):

image

Frankly I have no idea what the problem is:

  • wrong usage of Electron?
  • wrong usage of electron-windows-interactive-notifications?
  • problem in NodeRT?
  • problem in node-gyp?
  • problem in my environment?

Can you help me move a step closer to the problem resolution?

Thank you very much!

Question was also asked here

like image 206
Martin D Avatar asked Feb 17 '17 08:02

Martin D


People also ask

Does node js support Windows 7 32 bit?

Normally old operating system needs an old version of Node. JS. you can refer to old version of Node. JS here, you can also download this one, which is tested and working fine with Win7( win7 Ultimate v6.

Does node 16 support ES6?

Node js doesn't support ES6 import directly. If we try to use import for importing modules directly in node js it will throw out the error.

How install node using NVM in Windows?

Download the nvm-setup. Once downloaded, open the zip file, then open the nvm-setup.exe file. The Setup-NVM-for-Windows installation wizard will walk you through the setup steps, including choosing the directory where both nvm-windows and Node. js will be installed. Install the latest stable LTS release of Node.


1 Answers

Try following:

  • Install MS Visual Studio first.
  • npm install --global windows-build-tools run as Administrator
  • Run electron rebuild .\node_modules\.bin\electron-rebuild.cmd

Alternate method:

  • cd node_modules\electron-windows-interactive-notifications
  • node-gyp rebuild --target=1.8.4 --arch=x64 --dist-url=https://atom.io/download/electron where 1.8.4 is electron version
like image 195
KBIIX Avatar answered Oct 19 '22 11:10

KBIIX