2017-02-17 15 views
11

Tôi đang cố gắng viết ứng dụng Electron đơn giản sử dụng thông báo gốc của Windows. Đối với việc sử dụng này, tôi phụ thuộc vào electron-windows-interactive-notifications.Không thể sử dụng thư viện Windows nguyên bản trong NodeJS

Khi tôi chạy npm install và sau đó electron-rebuild về dự án của tôi, tôi nhận được:

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) 

Theo một NodeJS issue nó có thể là một vấn đề phụ thuộc bản xứ. Khi tôi kiểm tra notifications_bindings.node bởi dependencywalker tôi thấy sau DLL trực tiếp mất tích (trong số nhiều thiếu lồng nhau):

image

Thành thật mà nói tôi không có ý tưởng những gì vấn đề là:

sử dụng

Bạn có thể giúp tôi tiến một bước gần hơn đến giải pháp sự cố không?

Cảm ơn bạn rất nhiều!

Question was also asked here

+0

Dường như bạn đang thiếu node.dll và interactivenotifications.dll (để nói rằng ít nhất). Có phải chúng xuất hiện sang một bên tệp .exe chính của bạn (electron.exe hay cái gì khác) –

+0

@SimonMourier cảm ơn cho phản hồi. Vâng, khi tôi tìm kiếm thiếu .dlls, tôi thấy chúng ở các địa điểm sau: ** 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 '; Tôi sẽ nói rằng chúng cần được tương đối hoặc hoàn toàn được tham chiếu giống như kernel32.dll hoặc ole32.dll chính xác –

+1

bạn chỉ cần sao chép chúng trong cùng thư mục với exe chính (electron.exe hoặc khác nếu bạn đổi tên nó). Bạn không cần phải đặt chúng trong \ windows \ system32 –

Trả lời

0

Hãy thử sau:

  • Cài đặt MS Visual Studio đầu tiên.
  • npm install --global windows-build-tools Run as administrator
  • Run electron xây dựng lại .\node_modules\.bin\electron-rebuild.cmd
Các vấn đề liên quan