无法在NodeJS中使用本机Windows库

Mar*_*n D 14 node.js windows-runtime node-gyp windows-10 electron

我正在尝试编写一个使用Windows本机通知的简单Electron应用程序.为此,我依赖于电子窗口交互式通知.

当我在我的项目上运行npm install之后,electron-rebuild我得到:

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)
Run Code Online (Sandbox Code Playgroud)

根据NodeJS问题,它可能是本机依赖性问题.当我notifications_bindings.node通过dependencywalker检查时,我看到以下缺少直接的DLL(在许多缺少的嵌套中):

图片

坦率地说,我不知道问题是什么:

你能帮助我向问题解决方案迈进一步吗?

非常感谢你!

这里也提出了问题

KBI*_*IIX 1

尝试以下操作:

  • 首先安装 MS Visual Studio。
  • npm install --global windows-build-tools以管理员身份运行
  • 运行电子重建.\node_modules\.bin\electron-rebuild.cmd

替代方法:

  • cd node_modules\electron-windows-interactive-notifications
  • node-gyp rebuild --target=1.8.4 --arch=x64 --dist-url=https://atom.io/download/electron其中 1.8.4 是电子版本