porsager / busylight

node library for busylight
49 stars 17 forks source link

Error with node-hid on Node v8.9.1 #12

Closed ChsRmb closed 6 years ago

ChsRmb commented 6 years ago

Hey, i've get an error on Node v8.9.1.

/home/pathtoproject/electron/node_modules/electron/dist/electron[19378]: ../../vendor/node/src/node.cc:4451:void node::AtExit(node::Environment , void ()(void ), void ): Assertion `(env) != (nullptr)' failed. 1: node::Abort() [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 2: 0x7f594375c2f4 [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 3: 0x7f59437659bc [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 4: HID::Initialize(v8::Local) [/home/pathtoproject/electron/node_modules/node-hid/build/Release/HID.node] 5: 0x7f591c5725d9 [/home/pathtoproject/electron/node_modules/node-hid/build/Release/HID.node] 6: 0x7f594376330d [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 7: 0x7f594306aaa0 [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 8: 0x7f59434b4d08 [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 9: 0x7f59434b427e [/home/pathtoproject/electron/node_modules/electron/dist/libnode.so] 10: 0x38ac5d4843fd

My node-hid version is 0.5.7. The programm still works, if I don't use the busylight module. I've found the same error @LedgerHQ (https://github.com/LedgerHQ/ledger-node-js-api/issues/21). But they don't wrote a allround solution... Maybe you/someone known the error?

I'm currently working with Ubuntu 16.04. Cheers, ChaosRambo

porsager commented 6 years ago

Hi @ChaosRambo

I'm also experiencing issues with the latest nwjs version, but it's a problem with the node-hid package, not busylight.

These issues also relate to it: https://github.com/node-hid/node-hid/issues/233 https://github.com/node-hid/node-hid/issues/222

You can make sure node-hid works by doing this in your app:

var HID = require('node-hid');
var devices = HID.devices();
ChsRmb commented 6 years ago

Hey, thanks for the fast answer and sorry for the late answer from me...

Okay, I've testet node-hid and HID didn't work :( Sorry for the wrong Issue!

Cheers, ChaosRambo

porsager commented 6 years ago

No worries ;)

The issue was fixed in node-webkit and wasn't node-hid specific, so I guess it could be the same for electron.. You can check out these issues for more info, maybe to create an issue in the electron repo? https://github.com/node-hid/node-hid/issues/222 https://github.com/nwjs/nw.js/issues/6047

ChsRmb commented 6 years ago

Hey, I've found a solution for this problem :)

It's important to install electron-rebuild too. Here is a short example: "devDependencies": { "electron": "^1.7.5", "electron-rebuild": "^1.6.0" }

And the second important step is add: "postinstall": "electron-rebuild" to scripts!

Now you can run npm install

Here is the detailed solution: https://stackoverflow.com/a/45930921

Cheers, ChaosRambo