Get Keyboard/barcode (qr) input on Windows

I've got a generic QR code scanner which basically behaves like a keyboard. I'm trying to get this qr barcode input when a barcode is scanned.

Does anybody how to get this to work on Windows?

Would this help?

node-red-contrib-usbhid (node) - Node-RED (nodered.org)

I tried that but it doesn't allow me to install it.

what doesn't allow you to install it?

Unfortunately I'm only able to make a photo of the error.

How are you starting node-red? from a command terminal or powershell? Could you copy and past that error from there?

I start node red via the task scheduler on start-up "start a program" "C://.../node-red.cmd"

for now, just run it manually (ctrl+r and then type "node-red") so we can see the complete error output.

-----------------------------------------------------------
2022-11-18T13:54:55.994Z Install : node-red-contrib-usbhid 0.0.1

2022-11-18T13:54:56.339Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-usbhid@0.0.1
2022-11-18T13:55:01.986Z [err] npm
2022-11-18T13:55:01.988Z [err]  
2022-11-18T13:55:01.989Z [err] WARN
2022-11-18T13:55:01.989Z [err]  
2022-11-18T13:55:01.989Z [err] config
2022-11-18T13:55:01.989Z [err]  production Use `--omit=dev` instead.
2022-11-18T13:55:19.252Z [err] npm
2022-11-18T13:55:19.253Z [err]  ERR!
2022-11-18T13:55:19.253Z [err]  code 1
2022-11-18T13:55:19.254Z [err] npm ERR! 
2022-11-18T13:55:19.254Z [err] path C:\Users\qrane\.node-red\node_modules\node-hid
2022-11-18T13:55:19.262Z [err] npm
2022-11-18T13:55:19.262Z [err]  ERR! command failed
2022-11-18T13:55:19.262Z [err] npm 
2022-11-18T13:55:19.262Z [err] ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
2022-11-18T13:55:19.263Z [err] npm ERR!
2022-11-18T13:55:19.264Z [err]  gyp info it worked if it ends with ok
2022-11-18T13:55:19.264Z [err] npm ERR! gyp info using node-gyp@9.3.0
2022-11-18T13:55:19.264Z [err] npm ERR! gyp info using node@18.12.0 | win32 | x64
2022-11-18T13:55:19.264Z [err] npm ERR!
2022-11-18T13:55:19.264Z [err]  gyp ERR! find Python 
2022-11-18T13:55:19.264Z [err] npm ERR!
2022-11-18T13:55:19.264Z [err]  gyp ERR! find Python Python is not set from command line or npm configuration
2022-11-18T13:55:19.264Z [err] npm ERR!
2022-11-18T13:55:19.264Z [err]  gyp ERR! find Python Python is not set from environment variable PYTHON
2022-11-18T13:55:19.264Z [err] npm ERR! gyp ERR! find Python checking if "python3" can be used
2022-11-18T13:55:19.264Z [err] npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
2022-11-18T13:55:19.264Z [err] npm
2022-11-18T13:55:19.264Z [err]  ERR! gyp ERR! find Python checking if "python" can be used
2022-11-18T13:55:19.264Z [err] npm 
2022-11-18T13:55:19.264Z [err] ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
2022-11-18T13:55:19.264Z [err] npm ERR!
2022-11-18T13:55:19.264Z [err]  gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python39\python.exe
2022-11-18T13:55:19.264Z [err] npm ERR!
2022-11-18T13:55:19.264Z [err]  gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python39\python.exe" could not be run
2022-11-18T13:55:19.264Z [err] npm ERR!
2022-11-18T13:55:19.265Z [err]  gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
2022-11-18T13:55:19.265Z [err] npm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
2022-11-18T13:55:19.265Z [err] npm ERR! gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python39-32\python.exe
2022-11-18T13:55:19.265Z [err] npm ERR! gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
2022-11-18T13:55:19.265Z [err] npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
2022-11-18T13:55:19.265Z [err] npm
2022-11-18T13:55:19.266Z [err]  ERR! gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
2022-11-18T13:55:19.266Z [err] npm 
2022-11-18T13:55:19.266Z [err] ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
2022-11-18T13:55:19.266Z [err] npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
2022-11-18T13:55:19.266Z [err] npm
2022-11-18T13:55:19.267Z [err]  
2022-11-18T13:55:19.267Z [err] ERR!
2022-11-18T13:55:19.267Z [err]  gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python38\python.exe
2022-11-18T13:55:19.267Z [err] npm
2022-11-18T13:55:19.267Z [err]  
2022-11-18T13:55:19.268Z [err] ERR!
2022-11-18T13:55:19.268Z [err]  gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python38\python.exe" could not be run
2022-11-18T13:55:19.268Z [err] npm
2022-11-18T13:55:19.268Z [err]  
2022-11-18T13:55:19.268Z [err] ERR!
2022-11-18T13:55:19.269Z [err]  gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
2022-11-18T13:55:19.269Z [err] npm
2022-11-18T13:55:19.269Z [err]  
2022-11-18T13:55:19.269Z [err] ERR!
2022-11-18T13:55:19.269Z [err]  gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
2022-11-18T13:55:19.270Z [err] npm
2022-11-18T13:55:19.270Z [err]  
2022-11-18T13:55:19.270Z [err] ERR!
2022-11-18T13:55:19.270Z [err]  gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python38-32\python.exe
2022-11-18T13:55:19.270Z [err] npm
2022-11-18T13:55:19.270Z [err]  
2022-11-18T13:55:19.271Z [err] ERR!
2022-11-18T13:55:19.271Z [err]  gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
2022-11-18T13:55:19.271Z [err] npm
2022-11-18T13:55:19.271Z [err]  
2022-11-18T13:55:19.276Z [err] ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
2022-11-18T13:55:19.276Z [err] npm ERR! gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
2022-11-18T13:55:19.276Z [err] npm ERR!
2022-11-18T13:55:19.277Z [err]  gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
2022-11-18T13:55:19.277Z [err] npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
2022-11-18T13:55:19.277Z [err] npm ERR! gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python37\python.exe
2022-11-18T13:55:19.277Z [err] npm ERR! gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python37\python.exe" could not be run
2022-11-18T13:55:19.277Z [err] npm 
2022-11-18T13:55:19.277Z [err] ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
2022-11-18T13:55:19.277Z [err] npm ERR!
2022-11-18T13:55:19.277Z [err]  gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
2022-11-18T13:55:19.277Z [err] npm ERR!
2022-11-18T13:55:19.277Z [err]  gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python37-32\python.exe
2022-11-18T13:55:19.277Z [err] npm ERR! gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
2022-11-18T13:55:19.277Z [err] npm
2022-11-18T13:55:19.277Z [err]  ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
2022-11-18T13:55:19.277Z [err] npm 
2022-11-18T13:55:19.277Z [err] ERR! gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
2022-11-18T13:55:19.277Z [err] npm 
2022-11-18T13:55:19.277Z [err] ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
2022-11-18T13:55:19.277Z [err] npm ERR!
2022-11-18T13:55:19.277Z [err]  gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
2022-11-18T13:55:19.277Z [err] npm ERR!
2022-11-18T13:55:19.278Z [err]  gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python36\python.exe
2022-11-18T13:55:19.278Z [err] npm ERR! gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python36\python.exe" could not be run
2022-11-18T13:55:19.278Z [err] npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
2022-11-18T13:55:19.278Z [err] npm
2022-11-18T13:55:19.278Z [err]  ERR! gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
2022-11-18T13:55:19.278Z [err] npm 
2022-11-18T13:55:19.278Z [err] ERR! gyp ERR! find Python checking if Python is C:\Users\qrane\AppData\Local\Programs\Python\Python36-32\python.exe
2022-11-18T13:55:19.278Z [err] npm ERR!
2022-11-18T13:55:19.278Z [err]  gyp ERR! find Python - "C:\Users\qrane\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
2022-11-18T13:55:19.278Z [err] npm ERR!
2022-11-18T13:55:19.278Z [err]  gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
2022-11-18T13:55:19.278Z [err] npm ERR! gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
2022-11-18T13:55:19.278Z [err] npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
2022-11-18T13:55:19.278Z [err] npm
2022-11-18T13:55:19.278Z [err]  ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
2022-11-18T13:55:19.278Z [err] npm 
2022-11-18T13:55:19.278Z [err] ERR! gyp ERR! find Python checking if the py launcher can be used to find Python 3
2022-11-18T13:55:19.278Z [err] npm ERR!
2022-11-18T13:55:19.279Z [err]  gyp ERR! find Python - "py.exe" is not in PATH or produced an error
2022-11-18T13:55:19.279Z [err] npm ERR!
2022-11-18T13:55:19.279Z [err]  gyp ERR! find Python 
2022-11-18T13:55:19.279Z [err] npm ERR!
2022-11-18T13:55:19.279Z [err]  gyp ERR! find Python **********************************************************
2022-11-18T13:55:19.279Z [err] npm ERR! gyp ERR! find Python You need to install the latest version of Python.
2022-11-18T13:55:19.279Z [err] npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
2022-11-18T13:55:19.279Z [err] npm
2022-11-18T13:55:19.279Z [err]  ERR! gyp ERR! find Python you can try one of the following options:
2022-11-18T13:55:19.279Z [err] npm 
2022-11-18T13:55:19.279Z [err] ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
2022-11-18T13:55:19.279Z [err] npm ERR!
2022-11-18T13:55:19.279Z [err]  gyp ERR! find Python   (accepted by both node-gyp and npm)
2022-11-18T13:55:19.279Z [err] npm ERR!
2022-11-18T13:55:19.279Z [err]  gyp ERR! find Python - Set the environment variable PYTHON
2022-11-18T13:55:19.279Z [err] npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
2022-11-18T13:55:19.279Z [err] npm ERR! gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
2022-11-18T13:55:19.279Z [err] npm
2022-11-18T13:55:19.279Z [err]  ERR! gyp ERR! find Python For more information consult the documentation at:
2022-11-18T13:55:19.279Z [err] npm
2022-11-18T13:55:19.280Z [err]  ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
2022-11-18T13:55:19.280Z [err] npm ERR! gyp ERR! find Python **********************************************************
2022-11-18T13:55:19.280Z [err] npm
2022-11-18T13:55:19.280Z [err]  ERR! gyp ERR! find Python 
2022-11-18T13:55:19.280Z [err] npm
2022-11-18T13:55:19.280Z [err]  ERR! gyp ERR! configure error 
2022-11-18T13:55:19.280Z [err] npm ERR!
2022-11-18T13:55:19.280Z [err]  gyp ERR! stack Error: Could not find any Python installation to use
2022-11-18T13:55:19.280Z [err] npm ERR!
2022-11-18T13:55:19.280Z [err]  gyp ERR! stack     at PythonFinder.fail (C:\Users\qrane\node_modules\node-gyp\lib\find-python.js:330:47)
2022-11-18T13:55:19.280Z [err] npm ERR!
2022-11-18T13:55:19.280Z [err]  gyp ERR! stack     at PythonFinder.runChecks (C:\Users\qrane\node_modules\node-gyp\lib\find-python.js:159:21)
2022-11-18T13:55:19.280Z [err] npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\qrane\node_modules\node-gyp\lib\find-python.js:228:18)
2022-11-18T13:55:19.280Z [err] npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (C:\Users\qrane\node_modules\node-gyp\lib\find-python.js:294:16)
2022-11-18T13:55:19.280Z [err] npm
2022-11-18T13:55:19.280Z [err]  ERR! gyp ERR! stack     at exithandler (node:child_process:420:5)
2022-11-18T13:55:19.280Z [err] npm 
2022-11-18T13:55:19.281Z [err] ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:432:5)
2022-11-18T13:55:19.281Z [err] npm ERR!
2022-11-18T13:55:19.281Z [err]  gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
2022-11-18T13:55:19.281Z [err] npm ERR!
2022-11-18T13:55:19.281Z [err]  gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
2022-11-18T13:55:19.281Z [err] npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)
2022-11-18T13:55:19.281Z [err] npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2022-11-18T13:55:19.281Z [err] npm ERR! gyp ERR! System Windows_NT 10.0.19044
2022-11-18T13:55:19.281Z [err] npm 
2022-11-18T13:55:19.281Z [err] ERR!
2022-11-18T13:55:19.281Z [err]  gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\qrane\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
2022-11-18T13:55:19.281Z [err] npm ERR! gyp ERR! cwd C:\Users\qrane\.node-red\node_modules\node-hid
2022-11-18T13:55:19.282Z [err] npm ERR! gyp ERR! node -v v18.12.0
2022-11-18T13:55:19.282Z [err] npm
2022-11-18T13:55:19.282Z [err]  ERR! gyp ERR! node-gyp -v v9.3.0
2022-11-18T13:55:19.282Z [err] npm 
2022-11-18T13:55:19.284Z [err] ERR! gyp ERR! not ok
2022-11-18T13:55:19.295Z [err] 
2022-11-18T13:55:19.296Z [err] npm ERR! A complete log of this run can be found in:
2022-11-18T13:55:19.296Z [err] npm
2022-11-18T13:55:19.296Z [err]  
2022-11-18T13:55:19.297Z [err] ERR!
2022-11-18T13:55:19.297Z [err]      C:\Users\qrane\AppData\Local\npm-cache\_logs\2022-11-18T13_55_01_830Z-debug-0.log
2022-11-18T13:55:19.378Z rc=1

You don't have the Windows build tools installed.

Easiest thing to do is to grab the latest copy of the LTS release of Node.js for Windows and install it. It should ask if you want the build tools, accept that option. Restart node-red and you should be good to go.

1 Like