20

I've successfully built node.js addon, which works well with Node on Windows. Now, I want to create a Windows app using Electron. When loading the module in HTML file, I got the error:

var dbr = require('./build/Release/dbr');

enter image description here

Something wrong with ATOM_SHELL_ASAR.js. enter image description here

The issue only occurred on Windows. On Linux and Mac, it worked well.

How can I fix it?

Thanks!

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
yushulx
  • 11,695
  • 8
  • 37
  • 64

2 Answers2

23

You need to rebuild your native Node addon for Electron, the steps are outlined in the docs.

Vadim Macagon
  • 14,463
  • 2
  • 52
  • 45
  • I have rebuilt the module for Windows, and it's working now. Could you explain why I don't need to rebuild the module for Linux and Mac? Thanks. – yushulx Mar 17 '16 at 01:55
  • @yushulx Hi, i did rebuilt using electron rebuild , but still i am facing the same issue, anything i should be careful of while rebuilding – art-fan-vikram Apr 27 '17 at 09:18
1

I'm using Electron 2 version and have the same error with another module.

I solved this problem by this advise on Electron page: To ensure your native dependencies are always matched electron version, simply add script "postinstall": "electron-builder install-app-deps" to your package.json.

And then I changed: "postinstall": "electron-builder install-app-deps && npm run lint:fix". Then npm run postinstall.

max1119
  • 21
  • 1