How to install node-red-contrib-usbhid on Windows 10?

Does anyone have a cookbook on how to do this? Is it even possible?


Did you try it? It seems to suggest that it will just work.

My apologies. I did try it, and it failed dramatically with a ton of errors. I figured that anyone who had experience with it would have seen these same errors and either gave up or knew how to make it go.

Since you did have a go for yourself :grinning: , I also had a quick go.

Despite the fact that the readme for the node says that you don't need to run a compile on W10 64bit, you definitely do.

And, despite the fact that I have the latest Visual Studio build tools and C++ 2019 libraries installed, for some reason it can't find them.

Visual Studio Build Tools 2019                     Microsoft.VisualStudio.2019.BuildTools                    16.11.10                      winget
Microsoft Visual C++ 2015-2019 Redistributable (x… Microsoft.VC++2015-2019Redist-x64                         14.29.30135.0       14.29.30… winget
gyp ERR! find VS 
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.11.32126.315) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"

gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - missing any VC++ toolset
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS 
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS 
gyp ERR! configure error 
gyp ERR! stack Error: Could not find any Visual Studio installation to use

The problem lies with the node-hid dependency which fails to compile its libraries.

I suggest trying to raise an issue with the node's author on GitHub.

I'm using the Visual Studio Installer to add the v2019 C++ build tools - these appear to be different to the v2019 build tools - thanks again Microsoft!! But it is now asking for a machine reboot - thanks again Microsoft!! Can't be dealing with that just now, I'll try to remember to try again.

In the meantime, make sure you've installed at least the Microsoft 2019 C++ libraries on your PC. Assuming that you are using node.js v16 or above, you shouldn't need to install the Windows build tools as they are already included now in the Windows node.js installer.

Provided you tick the box (or leave it ticked) when you install nodejs.

I think I'm getting a handle on why this is failing. I had to downgrade node.js to 14.19.0 in order to install the modbus package, which is not compatible with 16.x.x.

So I uninstalled node.js, installed nvm-windows, got the older version of node.js, cleaned up a few things, and made sure to install all the Windows build tools (Visual Studio, Python) per the Windows install directions at the Node Red website.

After successfully installing the modbus nodes, I then retried the usbhid stuff. It seems that it's looking for Visual Studio 2017. I'll have to see if I can load that later.

The key error messages from the console:

12 Feb 08:15:14 - [info] Installing module: node-red-contrib-usbhid, version: 0.0.1
12 Feb 08:15:26 - [warn] Installation of module node-red-contrib-usbhid failed:
12 Feb 08:15:26 - [warn] ------------------------------------------
12 Feb 08:15:26 - [warn] prebuild-install WARN install No prebuilt binaries found (target=14.19.0 runtime=node arch=x64 platform=win32)
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1

This gets said pretty regularly in the forum. You can't just install nvm or similar and expect everything to work if you previously had node.js set up. Each version of node.js you install using nvm has a separate environment and that can have all sorts of effects.

Trying to keep it simple. I uninstalled 16.x.x and only have 14.19.0 installed ATT.

1 Like

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