Cant Install "node-red-contrib-usbhid" node

When installing the following node:

I an getting this error?
C:\Users\Justst03>npm install node-red-contrib-usbhid
npm ERR! code 1
npm ERR! path C:\Users\Justst03\node_modules\node-hid
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.2.0
npm ERR! gyp info using node@17.0.1 | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Justst03\AppData\Local\Programs\Python\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Justst03\AppData\Local\Programs\Python\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\Justst03\AppData\Local\Programs\Python\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\Justst03\AppData\Local\Programs\Python\Python39-32\python.exe" could not b

I guess with over 5 years - this node is too old that it can be installed.

No, its more likely the OP does not have the build tools installed.

@jts450

  1. You tried to install at path C:\Users\Justst03\ - I suspect this should be C:\Users\Justst03\.node-red\
  2. node-red is not tested on NODE V17 - so i would uninstall that & install NODE V16 LTS or NODE V14 LTS
  3. when you install NODE, there is a checkbox to install build tools - this must be checked if you are to install any nodes that have a compilation step
    image

Ahh.. ok, I need to see if Chocolatey will be approved by my IT team here at work. Do you know if I can go the the Chocolatey site and find the licensing agreement?

Alternatively ill see if I can install node-gyp

https://gprivate.com/5yk3e :slight_smile:

ok :grin: Thank you

I cant even get to the Chocolatey site from my work machine.

I guess is there another way to get a usb barcode reader data into node-red? I believe the barcode reader I have acts just like a keyboard since when I have Excel open and read a barcode the data is written in the open excel file field

Many do work like a keyboard - others have a setting where you can make the barcode reader appear as a COM port device and send values over serial. This is much better (IMO) for integration as you dont need a text field focused to get barcode input.
You will have to read the devices manual.

That said, the serial port will ALSO need to be compiled (to build tools will still need to be installed!)

Ok, I think I will have a hard time getting Chocolatey approved at work but so I might go with the other option of installing build tools manually.

to confirm on windows it looks like I need to install python and
Visual C++ before I run ( npm install -g node-gyp) based on these instructions?

Thanks,

I tested installing Node.js V16 on another PC we have outside of IT network and let Chocolatey/power shell do its thing. It looked like it automatically downloaded Python and Visual studio and installed everything properly but it still had these errors when trying to install the usbhid node?

2022-03-14T22:26:00.691Z [err] npm ERR!
2022-03-14T22:26:00.691Z [err]  gyp ERR! find VS **************************************************************
2022-03-14T22:26:00.691Z [err] npm ERR!
2022-03-14T22:26:00.692Z [err]  gyp ERR! find VS 
2022-03-14T22:26:00.692Z [err] npm ERR! gyp ERR! configure error 
2022-03-14T22:26:00.692Z [err] npm ERR!
2022-03-14T22:26:00.692Z [err]  gyp ERR! stack Error: Could not find any Visual Studio installation to use
2022-03-14T22:26:00.693Z [err] npm 
2022-03-14T22:26:00.693Z [err] ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
2022-03-14T22:26:00.693Z [err] npm ERR! gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
2022-03-14T22:26:00.693Z [err] npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
2022-03-14T22:26:00.694Z [err] npm ERR!
2022-03-14T22:26:00.694Z [err]  gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
2022-03-14T22:26:00.694Z [err] npm ERR!
2022-03-14T22:26:00.695Z [err]  gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
2022-03-14T22:26:00.695Z [err] npm ERR!
2022-03-14T22:26:00.695Z [err]  gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
2022-03-14T22:26:00.695Z [err] npm ERR!
2022-03-14T22:26:00.695Z [err]  gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
2022-03-14T22:26:00.695Z [err] npm ERR!
2022-03-14T22:26:00.696Z [err]  gyp ERR! stack     at ChildProcess.exithandler (node:child_process:406:5)
2022-03-14T22:26:00.696Z [err] npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
2022-03-14T22:26:00.696Z [err] npm 
2022-03-14T22:26:00.696Z [err] ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
2022-03-14T22:26:00.696Z [err] npm ERR! gyp ERR! System Windows_NT 10.0.19044
2022-03-14T22:26:00.696Z [err] npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
2022-03-14T22:26:00.696Z [err] npm 
2022-03-14T22:26:00.696Z [err] ERR! gyp ERR! cwd C:\Users\Administrator\.node-red\node_modules\node-hid
2022-03-14T22:26:00.696Z [err] npm ERR!
2022-03-14T22:26:00.697Z [err]  gyp ERR! node -v v16.14.0
2022-03-14T22:26:00.697Z [err] npm ERR! gyp ERR! node-gyp -v v8.4.1
2022-03-14T22:26:00.697Z [err] npm 
2022-03-14T22:26:00.697Z [err] ERR! gyp ERR! not ok
2022-03-14T22:26:00.704Z [err] 
2022-03-14T22:26:00.706Z [err] npm
2022-03-14T22:26:00.706Z [err]  
2022-03-14T22:26:00.708Z [err] ERR!
2022-03-14T22:26:00.710Z [err]  A complete log of this run can be found in:
2022-03-14T22:26:00.710Z [err] npm ERR!
2022-03-14T22:26:00.711Z [err]      C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-03-14T22_25_22_874Z-debug-0.log
2022-03-14T22:26:00.781Z rc=1

I still don't understand these errors and why I can install the HID node but looking at this

under general notes the HID node does not work with Barcode readers or keyboards?

It also talks about how the operating system owns these devices and they cant be read using this node. If that is true I am wondering what people use this node for successfully?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.