Node-red-node-discovery on Raspberry pi

I'm using this node on 2x Ubuntu machines and have spent the afternoon trying to get it installed on my Pi. All the pre-requisites are installed but I get the the following long list of errors. Any ideas anyone?


2021-10-31T16:44:28.898Z Install : node-red-node-discovery 0.0.23

2021-10-31T16:44:29.949Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-node-discovery@0.0.23
2021-10-31T16:44:34.995Z [err] npm
2021-10-31T16:44:34.999Z [err]  
2021-10-31T16:44:34.999Z [err] WARN old lockfile 
2021-10-31T16:44:34.999Z [err] npm
2021-10-31T16:44:35.000Z [err]  WARN 
2021-10-31T16:44:35.000Z [err] old lockfile The package-lock.json file was created with an old version of npm,
2021-10-31T16:44:35.001Z [err] npm WARN 
2021-10-31T16:44:35.001Z [err] old lockfile so supplemental metadata must be fetched from the registry.
2021-10-31T16:44:35.001Z [err] npm 
2021-10-31T16:44:35.001Z [err] WARN old lockfile
2021-10-31T16:44:35.002Z [err]  
2021-10-31T16:44:35.002Z [err] npm WARN
2021-10-31T16:44:35.002Z [err]  old lockfile This is a one-time fix-up, please be patient...
2021-10-31T16:44:35.002Z [err] npm 
2021-10-31T16:44:35.003Z [err] WARN old lockfile 
2021-10-31T16:44:52.148Z [err] npm
2021-10-31T16:44:52.149Z [err]  ERR! code
2021-10-31T16:44:52.150Z [err]  1
2021-10-31T16:44:52.150Z [err] npm 
2021-10-31T16:44:52.150Z [err] ERR! path /home/pi/.node-red/node_modules/mdns
2021-10-31T16:44:52.182Z [err] npm 
2021-10-31T16:44:52.183Z [err] ERR! command failed
2021-10-31T16:44:52.183Z [err] npm 
2021-10-31T16:44:52.184Z [err] ERR! command sh -c node-gyp rebuild
2021-10-31T16:44:52.184Z [err] npm ERR! make: Entering directory '/home/pi/.node-red/node_modules/mdns/build'
2021-10-31T16:44:52.185Z [err] npm ERR!   CXX(target) Release/obj.target/dns_sd_bindings/src/dns_sd.o
2021-10-31T16:44:52.185Z [err] npm ERR! make: Leaving directory '/home/pi/.node-red/node_modules/mdns/build'
2021-10-31T16:44:52.186Z [err] npm
2021-10-31T16:44:52.186Z [err]  ERR! gyp info it worked if it ends with ok
2021-10-31T16:44:52.186Z [err] npm
2021-10-31T16:44:52.187Z [err]  ERR! gyp info using node-gyp@8.3.0
2021-10-31T16:44:52.190Z [err] npm ERR! gyp info using node@12.20.2 | linux | arm
2021-10-31T16:44:52.190Z [err] npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
2021-10-31T16:44:52.190Z [err] npm ERR! gyp info spawn /usr/bin/python3
2021-10-31T16:44:52.190Z [err] npm ERR! gyp info spawn args [
2021-10-31T16:44:52.190Z [err] npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
2021-10-31T16:44:52.190Z [err] npm ERR! gyp info spawn args   'binding.gyp',
2021-10-31T16:44:52.190Z [err] npm
2021-10-31T16:44:52.191Z [err]  ERR! gyp info spawn args   '-f',
2021-10-31T16:44:52.191Z [err] npm ERR! gyp info spawn args   'make',
2021-10-31T16:44:52.191Z [err] npm ERR! gyp info spawn args   '-I',
2021-10-31T16:44:52.191Z [err] npm
2021-10-31T16:44:52.192Z [err]  ERR! gyp info spawn args   '/home/pi/.node-red/node_modules/mdns/build/config.gypi',
2021-10-31T16:44:52.192Z [err] npm
2021-10-31T16:44:52.192Z [err]  ERR! gyp info spawn args   '-I',
2021-10-31T16:44:52.193Z [err] npm ERR!
2021-10-31T16:44:52.193Z [err]  gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
2021-10-31T16:44:52.193Z [err] npm ERR!
2021-10-31T16:44:52.193Z [err]  gyp info spawn args   '-I',
2021-10-31T16:44:52.193Z [err] npm ERR!
2021-10-31T16:44:52.194Z [err]  gyp info spawn args   '/home/pi/.cache/node-gyp/12.20.2/include/node/common.gypi',
2021-10-31T16:44:52.194Z [err] npm 
2021-10-31T16:44:52.194Z [err] ERR! gyp info spawn args   '-Dlibrary=shared_library',
2021-10-31T16:44:52.194Z [err] npm 
2021-10-31T16:44:52.195Z [err] ERR! gyp info spawn args   '-Dvisibility=default',
2021-10-31T16:44:52.195Z [err] npm
2021-10-31T16:44:52.195Z [err]  ERR! gyp info spawn args   '-Dnode_root_dir=/home/pi/.cache/node-gyp/12.20.2',
2021-10-31T16:44:52.195Z [err] npm ERR!
2021-10-31T16:44:52.196Z [err]  gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
2021-10-31T16:44:52.196Z [err] npm 
2021-10-31T16:44:52.196Z [err] ERR! gyp info spawn args   '-Dnode_lib_file=/home/pi/.cache/node-gyp/12.20.2/<(target_arch)/node.lib',
2021-10-31T16:44:52.196Z [err] npm 
2021-10-31T16:44:52.196Z [err] ERR! gyp info spawn args   '-Dmodule_root_dir=/home/pi/.node-red/node_modules/mdns',
2021-10-31T16:44:52.196Z [err] npm
2021-10-31T16:44:52.203Z [err]  ERR! gyp info spawn args   '-Dnode_engine=v8',
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args   '--depth=.',
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args   '--no-parallel',
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args   '--generator-output',
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args   'build',
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args   '-Goutput_dir=.'
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args ]
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn make
2021-10-31T16:44:52.209Z [err] npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
2021-10-31T16:44:52.209Z [err] npm ERR! In file included from ../src/dns_sd.cpp:1:
2021-10-31T16:44:52.209Z [err] npm ERR! ../src/mdns.hpp:32:10: fatal error: dns_sd.h: No such file or directory
2021-10-31T16:44:52.209Z [err] npm ERR!  #include <dns_sd.h>
2021-10-31T16:44:52.209Z [err] npm ERR!           ^~~~~~~~~~
2021-10-31T16:44:52.209Z [err] npm ERR! compilation terminated.
2021-10-31T16:44:52.209Z [err] npm ERR! make: *** [dns_sd_bindings.target.mk:177: Release/obj.target/dns_sd_bindings/src/dns_sd.o] Error 1
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! build error 
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! System Linux 5.10.11-v7+
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! cwd /home/pi/.node-red/node_modules/mdns
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! node -v v12.20.2
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! node-gyp -v v8.3.0
2021-10-31T16:44:52.209Z [err] npm ERR! gyp ERR! not ok
2021-10-31T16:44:52.301Z [err] 
2021-10-31T16:44:52.301Z [err] npm ERR! A complete log of this run can be found in:
2021-10-31T16:44:52.301Z [err] npm ERR!     /home/pi/.npm/_logs/2021-10-31T16_44_52_226Z-debug.log
2021-10-31T16:44:52.333Z rc=1

What directory are you in when you run the npm command?
What is the exact npm command you run?

Thanks. I've tried 2 things:

  1. Installation from node-red's manage palette menu.
  2. Running npm install from /home/pi/.node-red.

Both have exactly the same result.

It will not install for me either, running Ubuntu 20.4 on a laptop. So not Pi specific. I get the same error. The solution for me was
sudo apt-get install libavahi-compat-libdnssd-dev
I have not looked to see whether the node indicates that as a pre-requisite.

[Edit] See the prerequisites section node-red-node-discovery (node) - Node-RED

Thanks Colin, I installed that and i now get a different page of errors, which will look into tomorrow.

Zenofmud, the exact npm command was

sudo npm install node-red-node-discovery

You shouldn’t install it using sudo- take a look at the readme on the GitHub page.

As @zenofmud says, using sudo is a bad idea. You may now have files in your home folder that are owned by root. That may well bite you at some point (you will get permissions errors trying to modify or delete files).

Solved! The problem was that the prerequisites had not installed properly. I did that using the Pi version of Synaptic, which seemed ok but for some reason was not. However, when I tried installing it using apt-get install, a long list of errors appeared.

When I tried to fix it using sudo apt-get update, it failed because "Inrelease changed its Suite value from Stable to Oldstable". That was fixed using sudo apt-update --allowreleaseinfochange and then I could install everything.

...but not using sudo with npm!

1 Like