Node-red serial comm palette failing to install

Hi, so I have been using the node-red-node-serialport for quite a while without any issue. I installed node-red using this method and followed the optional two steps for windows-build-tools. My version of nodejs is v12.

The following error is reported during installation of serial port palette,

2021-11-10T14:56:09.166Z [err] gyp ERR! node -v v12.19.0
2021-11-10T14:56:09.166Z [err] gyp ERR! node-gyp -v v5.1.0
2021-11-10T14:56:09.166Z [err] gyp ERR! not ok 
2021-11-10T14:56:09.686Z [err] npm 
2021-11-10T14:56:09.686Z [err] ERR! code ELIFECYCLE
2021-11-10T14:56:09.686Z [err] npm ERR! 
2021-11-10T14:56:09.687Z [err] errno 1
2021-11-10T14:56:09.705Z [err] npm 
2021-11-10T14:56:09.705Z [err] ERR! @serialport/bindings@9.2.5 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
2021-11-10T14:56:09.705Z [err] npm ERR! Exit status 1
2021-11-10T14:56:09.705Z [err] npm ERR!
2021-11-10T14:56:09.705Z [err]  
2021-11-10T14:56:09.705Z [err] npm ERR! Failed at the @serialport/bindings@9.2.5 install script.
2021-11-10T14:56:09.705Z [err] npm 
2021-11-10T14:56:09.705Z [err] ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-11-10T14:56:09.727Z [err] 
2021-11-10T14:56:09.727Z [err] npm ERR! A complete log of this run can be found in:
2021-11-10T14:56:09.727Z [err] npm ERR!

The installation fails after this. Any helps would be much appreciated.

Can you try it in a terminal, so go into your .node-red folder and run
npm install node-red-node-serialport
and copy/paste the complete output including the command line you entered.

Hi, so I uninstalled whatever node-red version was running. Reinstalled nodejs v16.0, reinstalled node-red. But the two optional steps got stuck, so I had to quit it. I then tried the installation from the command prompt, and found the below output:

npm install node-red-node-serialport
npm ERR! code 1
npm ERR! path C:\Users\xxxxx\node_modules\@serialport\bindings
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! prebuild-install WARN install No prebuilt binaries found (target=16.0.0 runtime=node arch=x64 libc= platform=win32)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.0.0 | 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 "python2" can be used
npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Python27\python.exe
npm ERR! gyp ERR! find Python - "C:\Python27\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python
npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:302:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:200:18)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:266:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:333:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:345:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:480:16)
npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.17763
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"
npm ERR! gyp ERR! cwd C:\Users\xxxxxxxxxx\node_modules\@serialport\bindings
npm ERR! gyp ERR! node -v v16.0.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxxxxxxxx\AppData\Local\npm-cache\_logs\2021-11-10T17_50_41_913Z-debug.log

Is it an issue with PYTHON not being present in the Environment Variable path?

Do you mean installing the build tools? That can take a very long time (hours on a slow machine or slow broadband). The errors suggest that the build tools were not installed.

The machine and internet were just fine. I am not exactly a software developer but a hunch made me install python and windows desktop development separately with their respective installers and it appeared to work. I have commented on a similar topic that you posted on the procedure

If you change Node version, rebuild command is needed for Serial Port.

Try this: go to (inside) folder C:\Users\xxxxx\node_modules\ and enter npm rebuild

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