2017-02-17 68 views
11

我正在尝试编写使用Windows本机通知的简单Electron应用程序。对于这个用途,我依赖于electron-windows-interactive-notifications无法在NodeJS中使用本地Windows库

当我运行npm installelectron-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) 

根据NodeJS issue它可以是天然的依赖性问题。当我检查由dependencywalkernotifications_bindings.node我看到下面缺少直接的DLL(中大量缺失嵌套):

image

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

Electron

你能帮助我更进一步地解决问题吗?

非常感谢!

Question was also asked here

+0

它看起来像你缺少node.dll和interactivenotifications.dll(至少可以这样说)。他们是否出现在你的主要.exe文件(electron.exe或其他) –

+0

@SimonMourier谢谢你的回应。那么,当我搜索丢失的.dll文件时,我会在以下位置看到它们: ** node.dll ** - 'node_modules \ electron \ dist \'; ** interactivenotifications.dll ** - 'node_modules \ electron-windows-interactive-notifications \ Release \'; ** api -...-。dll ** - 'c:\ Program Files(x86)\ Windows Kits \ 10 \ Redist \ ucrt \ DLLs \ x64 \ api-ms-win-crt-runtime-l1-1 -0.dll'; 我会说他们需要相对或绝对引用相同的方式,正确的kernel32.dll或ole32.dll –

+1

你应该只复制它们在主exe文件相同的目录(electron.exe或其他如果你重命名它)。你不需要把它们放在\ windows \ system32 –

回答

0

尝试以下操作:

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