Trouble installing: node-red-contrib-serial-modbus Node

Hello, newbee here with a question that's been confounding me for two days now. First I'm running Node-Red in a windows 10 environment. install went, for the most part OK except not really because although I can run node red and create some basic flows in the GUI. I cannot figure out how to get this specific node to install. When I start Node Red here's my info:

Microsoft Windows [Version 10.0.18362.657]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Windows\system32>node-red
10 Mar 08:08:08 - [info]

Welcome to Node-RED

10 Mar 08:08:08 - [info] Node-RED version: v1.0.4
10 Mar 08:08:08 - [info] Node.js version: v13.10.1
10 Mar 08:08:08 - [info] Windows_NT 10.0.18362 x64 LE
10 Mar 08:08:08 - [info] Loading palette nodes
10 Mar 08:08:09 - [info] Dashboard version 2.19.4 started at /ui
10 Mar 08:08:09 - [info] Settings file : \Users\Admin.node-red\settings.js
10 Mar 08:08:09 - [info] Context store : 'default' [module=memory]
10 Mar 08:08:09 - [info] User directory : \Users\Admin.node-red
10 Mar 08:08:09 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Mar 08:08:09 - [info] Flows file : \Users\Admin.node-red\flows_DESKTOP-P6O3A78.json
10 Mar 08:08:09 - [info] Server now running at http://127.0.0.1:1880/
10 Mar 08:08:09 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

10 Mar 08:08:09 - [info] Starting flows
10 Mar 08:08:09 - [info] Started flows
10 Mar 08:09:09 - [info] Installing module: node-red-contrib-modbus, version: 5.2.0
10 Mar 08:09:16 - [warn] Installation of module node-red-contrib-modbus failed:
10 Mar 08:09:16 - [warn] ------------------------------------------
10 Mar 08:09:16 - [warn] prebuild-install WARN install No prebuilt binaries found (target=13.10.1 runtime=node arch=x64 libc= 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
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:316:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18362
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"
gyp ERR! cwd C:\Users\Admin.node-red\node_modules\node-red-contrib-modbus\node_modules@serialport\bindings
gyp ERR! node -v v13.10.1
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @serialport/bindings@2.0.8 install: prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @serialport/bindings@2.0.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache_logs\2020-03-10T15_09_16_641Z-debug.log

10 Mar 08:09:16 - [warn] ------------------------------------------

After searching around this forum I found a few topics that related but I couldn't get any of them to work It seems the first error I would need to correct is this one:

10 Mar 08:09:16 - [warn] prebuild-install WARN install No prebuilt binaries found

How do I get these prebuilt binaries and how do I put them where they need to be?

Any guidance here would be greatly helpful as I'm at a stand still.

Also Here is what I get when trying to install the node via CMD\admin:

Microsoft Windows [Version 10.0.18362.657]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Windows\system32>npm install -g node-gyp
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
C:\Users\Admin\AppData\Roaming\npm\node-gyp -> C:\Users\Admin\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js

  • node-gyp@6.1.0
    updated 1 package in 2.466s

C:\Windows\system32>npm install node-red-contrib-serial-modbus

@serialport/bindings@8.0.7 install C:\Windows\system32\node_modules@serialport\bindings
prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=13.10.1 runtime=node arch=x64 libc= platform=win32)

C:\Windows\system32\node_modules@serialport\bindings>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
MSBUILD : error MSB1009: Project file does not exist.
Switch: build/binding.sln
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
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:316:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18362
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"
gyp ERR! cwd C:\Windows\system32\node_modules@serialport\bindings
gyp ERR! node -v v13.10.1
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @serialport/bindings@8.0.7 install: prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @serialport/bindings@8.0.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache_logs\2020-03-10T16_12_24_492Z-debug.log

C:\Windows\system32>npm install --verbose sharp
npm info it worked if it ends with ok
npm verb cli [
npm verb cli 'C:\Program Files\nodejs\node.exe',
npm verb cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
npm verb cli 'install',
npm verb cli '--verbose',
npm verb cli 'sharp'
npm verb cli ]
npm info using npm@6.13.7
npm info using node@v13.10.1
npm verb npm-session 84b1a6575b7157d6
npm http fetch GET 304 https://registry.npmjs.org/sharp 177ms (from cache)
npm timing stage:loadCurrentTree Completed in 353ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 85ms
npm http fetch GET 304 https://registry.npmjs.org/semver 73ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 143ms
npm timing stage:loadIdealTree Completed in 265ms
npm timing stage:generateActionsToTake Completed in 9ms
npm verb correctMkdir C:\Users\Admin\AppData\Roaming\npm-cache_locks correctMkdir not in flight; initializing
npm verb makeCacheDir UID & GID are irrelevant on win32
npm verb lock using C:\Users\Admin\AppData\Roaming\npm-cache_locks\staging-ecddf487eb87445c.lock for C:\Windows\system32\node_modules.staging
npm timing action:extract Completed in 34ms
npm info lifecycle sharp@0.25.1~preuninstall: sharp@0.25.1
npm info lifecycle sharp@0.25.1~uninstall: sharp@0.25.1
npm verb unbuild rmStuff sharp@0.25.1 from C:\Windows\system32\node_modules
npm info lifecycle sharp@0.25.1~postuninstall: sharp@0.25.1
npm timing action:unbuild Completed in 4ms
npm timing action:remove Completed in 117ms
npm timing action:finalize Completed in 5ms
npm timing action:refresh-package-json Completed in 7ms
npm info lifecycle sharp@0.25.1~preinstall: sharp@0.25.1
npm timing action:preinstall Completed in 1ms
npm info linkStuff sharp@0.25.1
npm timing action:build Completed in 1ms
npm info lifecycle sharp@0.25.1~install: sharp@0.25.1

sharp@0.25.1 install C:\Windows\system32\node_modules\sharp
(node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached C:\Users\Admin\AppData\Roaming\npm-cache_libvips\libvips-8.9.1-win32-x64.tar.gz
info sharp Creating C:\Windows\system32\node_modules\sharp\build\Release
info sharp Copying DLLs from C:\Windows\system32\node_modules\sharp\vendor\lib to C:\Windows\system32\node_modules\sharp\build\Release
prebuild-install info begin Prebuild-install version 5.3.3
prebuild-install info looking for cached prebuild @ C:\Users\Admin\AppData\Roaming\npm-cache_prebuilds\c70b6e-sharp-v0.25.1-napi-v3-win32-x64.tar.gz
prebuild-install info found cached prebuild
prebuild-install info unpacking @ C:\Users\Admin\AppData\Roaming\npm-cache_prebuilds\c70b6e-sharp-v0.25.1-napi-v3-win32-x64.tar.gz
prebuild-install info unpack resolved to C:\Windows\system32\node_modules\sharp\build\Release\sharp.node
prebuild-install info install Successfully installed prebuilt binary!
npm verb lifecycle sharp@0.25.1~install: unsafe-perm in lifecycle true
npm verb lifecycle sharp@0.25.1~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Windows\system32\node_modules\sharp\node_modules.bin;C:\Windows\system32\node_modules.bin;C:\Python38\Scripts;C:\Python38;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\Users\Admin\AppData\Roaming\npm
npm verb lifecycle sharp@0.25.1~install: CWD: C:\Windows\system32\node_modules\sharp
npm timing audit submit Completed in 219ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 219ms
npm timing audit body Completed in 0ms
npm timing action:install Completed in 1519ms
npm info lifecycle sharp@0.25.1~postinstall: sharp@0.25.1
npm timing action:postinstall Completed in 0ms
npm verb unlock done using C:\Users\Admin\AppData\Roaming\npm-cache_locks\staging-ecddf487eb87445c.lock for C:\Windows\system32\node_modules.staging
npm timing stage:executeActions Completed in 1709ms
npm timing stage:rollbackFailedOptional Completed in 0ms
npm timing stage:runTopLevelLifecycles Completed in 2364ms
npm WARN saveError ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm verb shrinkwrap skipping write for package-lock.json because there were no changes.
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN enoent ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm verb enoent This is related to npm not being able to find a file.
npm verb enoent
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.

  • sharp@0.25.1
    updated 1 package and audited 657 packages in 2.417s

2 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

npm verb exit [ 0, true ]
npm timing npm Completed in 2842ms
npm info ok

C:\Windows\system32>

OK I think I solved it! If anyone else is a new user and all this feels a little overwhelming you are not alone. What worked for me is going back and examining how I had installed Node-Red and Node.js.
I Think the key (for me) was noticing how I had to install everything from the (OpenAsAdmin) Windows PowerShell as opposed to the CMD prompt. For this I also had to allow scripts in the W.P.S. because it wasn't working when I tried this origionally so I went to the CMD prompt instead (my mistake).
After allowing scripts I reinstalled everything again (right over the top of my old install) and configured an old version of Python2.7 as the Node-Red used version. with this command

npm install --global --production --add-python-to-path windows-build-tools

here's the info that came up when I entered these commands:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Windows\system32> Set-ExecutionPolicy RemoteSigned

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
PS C:\Windows\system32> npm install --global --production --add-python-to-path windows-build-tools
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

windows-build-tools@5.2.2 postinstall C:\Users\Admin\AppData\Roaming\npm\node_modules\windows-build-tools
node ./dist/index.js

Downloading python-2.7.15.amd64.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\Admin.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[> ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\Admin.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Still waiting for installer log file...

Now configuring the Visual Studio Build Tools and Python...

All done!

  • windows-build-tools@5.2.2
    added 144 packages from 98 contributors in 18.961s
    PS C:\Windows\system32> node-red
    10 Mar 11:23:37 - [info]

Welcome to Node-RED

10 Mar 11:23:37 - [info] Node-RED version: v1.0.4
10 Mar 11:23:37 - [info] Node.js version: v13.10.1
10 Mar 11:23:37 - [info] Windows_NT 10.0.18362 x64 LE
10 Mar 11:23:38 - [info] Loading palette nodes
10 Mar 11:23:39 - [info] Dashboard version 2.19.4 started at /ui
10 Mar 11:23:39 - [info] Settings file : \Users\Admin.node-red\settings.js
10 Mar 11:23:39 - [info] Context store : 'default' [module=memory]
10 Mar 11:23:39 - [info] User directory : \Users\Admin.node-red
10 Mar 11:23:39 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Mar 11:23:39 - [info] Flows file : \Users\Admin.node-red\flows_DESKTOP-P6O3A78.json
10 Mar 11:23:39 - [info] Server now running at http://127.0.0.1:1880/
10 Mar 11:23:39 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

10 Mar 11:23:39 - [info] Starting flows
10 Mar 11:23:39 - [info] Started flows

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