MadLittleMods / node-usb-detection

List USB devices in system and detect changes on them.
MIT License
370 stars 114 forks source link

Add docs for how to recompile for Electron #118

Closed carboleda closed 3 years ago

carboleda commented 4 years ago

This change help to fix issue #116 Steps to fix error detection.node was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 80. This error occur when usb-detection module is used together with electron.js

MadLittleMods commented 4 years ago

Thanks for tackling this @carboleda 🙂

mcous commented 4 years ago

This is a cool addition to the docs and would've been helpful when we were adding the usb-detection dependency to our Electron app!

I found the Electron docs' page on using native modules to be very helpful during this setup. Perhaps this module's documentation might be a little easier to maintain if it was mostly just a link to the Electron docs?

# Install

...

## Install for Electron

This module uses native extensions and needs to be compiled for your
target version of Electron. Precompiled binaries for recent Node.js and
Electron versions are built and published using [prebuild][] and can be
installed automatically using [electron-rebuild][].

See the [Electron docs for using native modules][electron-native-modules]
to ensure your project is set up to correctly use the prebuilt binaries for
your version of Electron.

[prebuild]: https://github.com/prebuild/prebuild
[electron-rebuild]: https://github.com/electron/electron-rebuild
[electron-native-modules]: https://www.electronjs.org/docs/tutorial/using-native-node-modules
MadLittleMods commented 4 years ago

@mcous This is a great alternative! Also open to this instead if you want to create a PR

mcous commented 4 years ago

Definitely wouldn't want to snipe a good contribution from @carboleda, so I'd rather leave this as advice for them to potentially incorporate into their PR that they already put the effort into opening. Just saw this open and wanted to chime in because I had experienced the same problem

MadLittleMods commented 4 years ago

@carboleda The heading and description that @mcous suggested reads really nice. We can use that and add your steps below.

MadLittleMods commented 4 years ago

Thanks for being courteous @mcous ❤️

carboleda commented 4 years ago

@carboleda The heading and description that @mcous suggested reads really nice. We can use that and add your steps below.

Ok @MadLittleMods that's perfect for me, the description of @mcous is very relevant! @mcous could you create a PR?

mcous commented 4 years ago

@carboleda @MadLittleMods sure thing! I'll put a PR up tonight

MadLittleMods commented 4 years ago

@carboleda https://github.com/MadLittleMods/node-usb-detection/pull/120 is now merged. Are you still interested in rebasing on master and adding your instruction step list below that Electron install section?

carboleda commented 3 years ago

@carboleda #120 is now merged. Are you still interested in rebasing on master and adding your instruction step list below that Electron install section?

Yes, of course! I going to update my PR!

MadLittleMods commented 3 years ago

Closing as review points were never met