TooTallNate / ref

Turn Buffer instances into "pointers"
http://tootallnate.github.com/ref
453 stars 141 forks source link

Error: Module did not self-register. #53

Closed nazar322 closed 7 years ago

nazar322 commented 8 years ago

After adding

var ref = require('ref');

to my main JS file in Electron I got this error when I launch my app.

App threw an error during load Error: Module did not self-register. at Error (native) at process.module.(anonymous function) as dlopen at Object.Module._extensions..node (module.js:568:18) at Object.module.(anonymous function) as .node at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at bindings (C:\Users\Nazar\Documents\electron\ytd-v5-el\node_modules\ref\node_modules\bindings\bindings.js:76:44)

Please suggest me how can I fix it.

nazar322 commented 7 years ago

Ok, I was able to fix this issue by rebuilding ref module for Electron version installed on my system (1.3.5).

Refer to this article Using Native Node Modules

I installed node-gyp and then I ran cd /path-to-module/ HOME=~/.electron-gyp node-gyp rebuild --target=1.3.5 --arch=x64 --dist-url=https://atom.io/download/atom-shell and it did work.

Make sure you use proper shell interface, Windows Command Prompt won't recognize HOME=~. I recommend to use Git Bash Terminal.