node-dmx / dmx

DMX controller library for node.js
MIT License
300 stars 92 forks source link

Error when using any USB-Driver with Electron #47

Closed s3n-w6i closed 6 years ago

s3n-w6i commented 6 years ago

I was trying to use this node module with the electron framework. As soon as I created a new DMX() I got this error:

Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\user\Documents\project-dir\node_modules\serialport\build\Release\serialport.node

When I commented out all this.registerDriver() using serialport the error was gone. dmx.js :

function DMX(options) {
    var options = options || {}
    this.universes = {}
    this.drivers   = {}
    this.devices   = options.devices || require('./devices')

    this.registerDriver('null',                   require('./drivers/null'))
    /*
    this.registerDriver('dmx4all',                require('./drivers/dmx4all'))
    this.registerDriver('enttec-usb-dmx-pro',     require('./drivers/enttec-usb-dmx-pro'))
    this.registerDriver('enttec-open-usb-dmx',    require('./drivers/enttec-open-usb-dmx'))
    this.registerDriver('dmxking-ultra-dmx-pro',  require('./drivers/dmxking-ultra-dmx-pro'))
    */
    this.registerDriver('artnet',                 require('./drivers/artnet'))
    this.registerDriver('bbdmx',                  require('./drivers/bbdmx'))
}

I already tried this which didn't work. I have tested this on a Windows-PC.

s3n-w6i commented 6 years ago

Ok, so I had a look at the EasyCue source code where I found a node_modules folder inside the dmx folder (project-directory > node_modules > dmx > node_modules). I installed serialport and electron-rebuild there and after executing .\node_modules\.bin\electron-rebuild.cmd as described here it worked.