Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 10 14:15
    RedskyThirty commented #132
  • May 06 23:43

    dependabot[bot] on npm_and_yarn

    (compare)

  • May 06 23:43

    MadLittleMods on master

    Bump lodash from 4.17.19 to 4.1… (compare)

  • May 06 23:43
    MadLittleMods closed #142
  • May 06 21:44
    dependabot[bot] labeled #142
  • May 06 21:44
    dependabot[bot] opened #142
  • May 06 21:44

    dependabot[bot] on npm_and_yarn

    Bump lodash from 4.17.19 to 4.1… (compare)

  • May 06 20:21
    MadLittleMods labeled #141
  • May 06 20:21
    MadLittleMods labeled #141
  • May 06 01:41
    robbiewu008 opened #141
  • May 05 17:06
    MadLittleMods edited #134
  • May 05 17:06
    MadLittleMods labeled #140
  • May 05 17:06
    MadLittleMods labeled #140
  • May 05 17:06
    MadLittleMods edited #140
  • May 05 17:04
    MadLittleMods commented #140
  • May 05 17:03
    MadLittleMods commented #140
  • May 05 13:24
    fbede4 commented #140
  • May 05 13:17
    fbede4 commented #140
  • May 05 12:42
    fbede4 edited #140
  • May 05 12:37
    fbede4 edited #140
Alex Van Camp
@Lange
lgtm for publish
i will be very grateful for all this in a few months
will make my CI and deployment workflows much easier
and also make it easier for people who just want to check out the project, without them needing to install a full compiler toolchain
Eric Eastwood
@MadLittleMods

Thanks again for your work on the prebuilt binaries!

https://www.npmjs.com/package/usb-detection 2.1.0 published :elephant:

Alex Van Camp
@Lange
which was extra hard for node-usb-detection, because the default installation of windows-build-tools doesn't have everything needed for node-usb-detection to compile
so getting people up and running with it was pretty hard
nice, grats on the publish
Eric Eastwood
@MadLittleMods
Ye, native modules are painful but this is sooo slick :snake:
Alex Van Camp
@Lange
fwiw, might want to link to this or copy some of it in the readme, idk felixrieseberg/windows-build-tools#59
i actually re-found this issue like 6 months after i opened it, and I had no memory of opening it
but i had clearly struggled with this before lol
Eric Eastwood
@MadLittleMods
@Lange Could add it under this section, https://github.com/MadLittleMods/node-usb-detection#windows - Feel free to submit a PR
Alex Van Camp
@Lange
yeah i might throw it in there
Lalit Kumar
@lalitmee
hello guys..
I need a help
I am trying to use node-usb-detection in electron desktop application.. but when I am running webpack, it is showing some warning.. I have tried a lot but no luck.. please help me..
Actually I am using React.js in electron for which I have to run webpack. So these are the warnings https://github.com/MadLittleMods/node-usb-detection/issues/25#issuecomment-368014008
Eric Eastwood
@MadLittleMods
@lalitmee Please create a separate issue instead glomming onto a slightly related issue. Please include which version of npm, webpack, etc you are using so people can better try to reproduce
Lalit Kumar
@lalitmee
okk
I will
Rio Del S. Pamaong
@riodel27
Hello, I just want to make a suggestion regarding the usb-detection https://www.npmjs.com/package/usb-detection. I just think that i'd be great if the absolute path of where the device is being added and removed will be helpful. Because you can have a multiple device connected with the same vid, pid and it will be hard to identify which one was removed. I don't know if adding that feature will be possible. Thanks
Eric Eastwood
@MadLittleMods
@riodel27 It seems like you are after MadLittleMods/node-usb-detection#19
Rio Del S. Pamaong
@riodel27
@MadLittleMods I'm not quite sure. But basically I just think that I'd be great if absolute path is included as one of the data coming back from the call back function after executing usbDetect.on(add or remove) . ex: / Console output:
{
locationId: 0,
vendorId: 5824,
productId: 1155,
deviceName: 'Teensy USB Serial (COM3)',
manufacturer: 'PJRC.COM, LLC.',
serialNumber: '',
deviceAddress: 11,
}
/
/ Console output:
{
locationId: 0,
vendorId: 5824,
productId: 1155,
deviceName: 'Teensy USB Serial (COM3)',
manufacturer: 'PJRC.COM, LLC.',
serialNumber: '',
deviceAddress: 11,
absolutePath: ?? /
absolute path here / ex: path: '\\?\hid#vid_093a&pid_2510#6&838b31&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}',
}
/
Eric Eastwood
@MadLittleMods
@riodel27 I think MadLittleMods/node-usb-detection#19 covers your case. You can also track MadLittleMods/node-usb-detection#51 which has the path
Eric Eastwood
@MadLittleMods
v3.0.3 just published to npm :tada:
  • Can now distinguish and show duplicate USB devices on Windows
  • Dependencies updated
gdetra
@gdetra
Hi guys, i have a question for you. I'm using ubuntu 17.10 and i'm trying to install usb detection but i receive "error parsing json" or something similar. Can you help me?
Eric Eastwood
@MadLittleMods
@gdetra Can you paste the full error? (npm install output)
gdetra
@gdetra
npm ERR! registry error parsing json
gdetra
@gdetra
now i have tried and all goes well!! i don't know if you have done something. I have another question. How can i use this library on Linux, Windows and MacOS without any problem? I have to install only dependencies?
Eric Eastwood
@MadLittleMods

@gdetra I can not reproduce on Windows 10, macOS 10.12.6, or Ubuntu 18.04. I didn't do anything to fix it but glad it's working for you now

Just install it. usb-detection works across all platforms without any external dependencies. We even have pre-built binaries that magically install so you don't need Node.js native module build dependencies

gdetra
@gdetra
I'll try on windows and share with you the result.
Thank you for now @MadLittleMods !!
gdetra
@gdetra

This error is shown on Windows:

C:\Users\Gabriele\Desktop\UsbDetection>node app.js
C:\Users\Gabriele\Desktop\UsbDetection\node_modules\bindings\bindings.js:88
throw e
^

Error: \?\C:\Users\Gabriele\Desktop\UsbDetection\node_modules\usb-detection\build\Release\detection.node non è un'applicazione di Win32 valida.
\?\C:\Users\Gabriele\Desktop\UsbDetection\node_modules\usb-detection\build\Release\detection.node
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at bindings (C:\Users\Gabriele\Desktop\UsbDetection\node_modules\bindings\bindings.js:81:44)
at Object.<anonymous> (C:\Users\Gabriele\Desktop\UsbDetection\node_modules\usb-detection\index.js:10:37)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Gabriele\Desktop\UsbDetection\app.js:1:79)

Eric Eastwood
@MadLittleMods

@gdetra I'm not sure and that is a localized error so I am not sure exactly what it says. It sounds like it is complaining it not being a valid win32 application.

Are you using usb-detection in electron?

See MadLittleMods/node-usb-detection#58

Adriano Kairalla
@adkairalla_gitlab
Hello, I'm trying to use the usb-detection library with electron. It doesn't complain version wise, but as soon as I call a function I'm getting a bindings errors like this:
Uncaught Error: Could not locate the bindings file. Tried:/home/adriano.kairalla@kryptus.lan/git/kgapp/build/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/build/Debug/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/build/Release/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/out/Debug/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/Debug/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/out/Release/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/Release/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/build/default/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/compiled/14.16.0/linux/x64/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/addon-build/release/install-root/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/addon-build/debug/install-root/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/addon-build/default/install-root/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/lib/binding/node-v87-linux-x64/detection.node
    at bindings (bindings.js:126)
    at Object../node_modules/usb-detection/index.js (index.js:13)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:100)
    at Module../src/pages/Main/index.tsx (index.tsx:1)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:100)
    at Module../src/app.tsx (log.js:59)
    at __webpack_require__ (bootstrap:789)
    at fn (bootstrap:100)
bindings    @    bindings.js:126
./node_modules/usb-detection/index.js    @    index.js:13
__webpack_require__    @    bootstrap:789
fn    @    bootstrap:100
./src/pages/Main/index.tsx    @    index.tsx:1
__webpack_require__    @    bootstrap:789
fn    @    bootstrap:100
./src/app.tsx    @    log.js:59
__webpack_require__    @    bootstrap:789
fn    @    bootstrap:100
./src/index.tsx    @    index.tsx:1
__webpack_require__    @    bootstrap:789
fn    @    bootstrap:100
0    @    main.js:350791
__webpack_require__    @    bootstrap:789
(anonymous)    @    bootstrap:856
(anonymous)    @    bootstrap:856
In my case, I'm calling the library with
import usb from "usb-detection"

const Main: React.FC = () => {
  const auth = Auth.getAuth();
  i18n.use(initReactI18next);
  const history = useHistory();

  // Do some detection
  const teste = usb.startMonitoring();
Adriano Kairalla
@adkairalla_gitlab
as for the imports, I only have a root package.json in the same folder my webpacks are (I have one for react and one for electron) where the dependency was added
Eric Eastwood
@MadLittleMods
@adkairalla_gitlab What version of Electron are you using? Have you rebuilt for Electron? https://github.com/MadLittleMods/node-usb-detection#install-for-electron
Adriano Kairalla
@adkairalla_gitlab
Aye I have rebuilt for electron, apparently the problem is, as you can see in the log, the require('binding')('detection.node') in the code is not searching inside my node_modules folder for the correct usb-detection package
I managed to compile (though this is more of a test and not a solution) by creating a symbolic link somewhere it would see the detection.node
Adriano Kairalla
@adkairalla_gitlab
And for some reason everytime I unplug my pendrive with a remove listener, it runs the console.log a lot of times
Eric Eastwood
@MadLittleMods

@adkairalla_gitlab Curious of any follow-up if you come up with a solution. Weird bundling with Electron?

If you want to debug where Node is looking for the package, you can use the following, but sounds like you have narrowed it down

NODE_DEBUG=module node -e "console.log(require.resolve('usb-detection'));"
Adriano Kairalla
@adkairalla_gitlab
Node is looking for the package in these folders
/home/adriano.kairalla@kryptus.lan/git/kgapp/build/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/build/Debug/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/build/Release/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/out/Debug/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/Debug/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/out/Release/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/Release/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/build/default/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/compiled/14.16.0/linux/x64/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/addon-build/release/install-root/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/addon-build/debug/install-root/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/addon-build/default/install-root/detection.node
 → /home/adriano.kairalla@kryptus.lan/git/kgapp/lib/binding/node-v87-linux-x64/detection.node
But the file would be in /home/adriano.kairalla@kryptus.lan/git/kgapp/node_modules/usb-detection/<search here would work>
Eric Eastwood
@MadLittleMods
@adkairalla_gitlab That is weird! Your expected path looks correct to me -> ./node_modules/usb-detection/build/Release/detection.node
Eric Eastwood
@MadLittleMods
@adkairalla_gitlab If you have any quick pointers for MadLittleMods/node-usb-detection#137, it seems like a similar thing to what you ran into
Adriano Kairalla
@adkairalla_gitlab
@MadLittleMods tried to give some insight of the procedure I followed, but unfortunately I'm not an electron programmer. I was actually fixing an issue that a third company did on our project. I did manage to get usb-detection to work with the electron-rebuild and doing the symbolic link ¨fix¨, but I think there is another way to add native packages to electron projects which I´m not familiar with and would be more professional level.
Eric Eastwood
@MadLittleMods
Thanks @adkairalla_gitlab :heart: Definitely useful to document what worked and to know that it is possible!