Debian 10 won't run this module
Opened this issue · 4 comments
Here's some context:
debian@bgw00000000:~/prototypeF$ nvm --version
0.38.0
debian@bgw00000000:~/prototypeF$ node --version
v14.17.3
debian@bgw00000000:~/prototypeF$ npm --version
7.20.0
debian@bgw00000000:~/prototypeF$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
debian@bgw00000000:~/prototypeF$ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 995.32
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2
Hardware : Generic AM33XX (Flattened Device Tree)
Revision : 0000
Serial : BBGW16055134
debian@bgw00000000:~/prototypeF$
On a new, small express sample project I npm install mdns --save
debian@bgw00000000:~/prototypeF$ npm list mdns
prototypef@1.0.0 /home/debian/prototypeF
└── mdns@2.7.2
Then I write a simple piece of server side code in a class to broadcast that I have a web server on port 80, which looks something like this:
createmDNSAdvertisement() {
let port = process.env.NODE_PORT || 80
const httpAd = mdns.createAdvertisement(mdns.tcp('http'), parseInt(port))
httpAd.start()
}
But when I npm start
, I get the following:
debian@bgw00000000:~/prototypeF$ npm start
> prototypef@1.0.0 start
> export $(cat .env | xargs) && nodemon main.js
[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node main.js`
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
-- mDNS: mDNS Advertising as MintonTech
/home/debian/prototypeF/node_modules/mdns/lib/advertisement.js:56
dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
^
Error: dns service error: unknown
at new Advertisement (/home/debian/prototypeF/node_modules/mdns/lib/advertisement.js:56:10)
at Object.create [as createAdvertisement] (/home/debian/prototypeF/node_modules/mdns/lib/advertisement.js:64:10)
at MulticastDNSService.createmDNSAdvertisement (/home/debian/prototypeF/service-mdns.js:31:25)
at new MulticastDNSService (/home/debian/prototypeF/service-mdns.js:24:10)
at Object.<anonymous> (/home/debian/prototypeF/main.js:67:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
errorCode: -65537
}
[nodemon] app crashed - waiting for file changes before starting...
So line 31 of my service-mdns.js looks like this:
const httpAd = mdns.createAdvertisement(mdns.tcp('http'), parseInt(port))
I've read some projects which claim that lines starting with *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
is normal and to just ignore it. But as you can see, I can't simply ignore it. I've installed previous versions, like 5.2.1. I've tried installing/updating everything from my build tools to the avahi library installed on my system.
I'm assuming it's an issue with the npm package, but I'm not certain. Is anyone else having similar issues? If so, what fixed it for you? Or is this package being phased out as some claim?
Thanks
PS. My package.json file:
{
"name": "prototypef",
"version": "1.0.0",
"description": "PrototypeF for use with PrototypeA",
"main": "main.js",
"dependencies": {
"bluebird": "^3.5.1",
"body-parser": "^1.18.2",
"bonescript": "^0.7.4-beta1",
"cors": "^2.8.5",
"dotenv": "^4.0.0",
"express": "^4.16.2",
"mdns": "^2.7.2",
"moment": "^2.24.0",
"node-fetch": "^2.6.1",
"pm2": "^4.2.1",
"ramda": "^0.17.1",
"request-promise": "^2.0.1",
"socket.io": "^2.3.0",
"socket.io-client": "^2.3.0",
"sqlite3": "^5.0.2",
"uuid": "^8.3.1"
},
"optionalDependencies": {
"fsevents": "^2.3.2"
},
"devDependencies": {
"nodemon": "^1.7.3"
},
"keywords": [
"prototype"
],
"author": "John",
"license": "MIT",
"bugs": {
"url": ""
},
"homepage": "",
"scripts": {
"start": "export $(cat .env | xargs) && nodemon main.js",
"tracewarnings": "export $(cat .env | xargs) && node --trace-warnings main.js",
"startpm2": "pm2 start main.js",
"restartpm2": "pm2 restart all"
}
}
Following the advice from homebridge/homebridge#613:
sudo apt-get install avahi-daemon avahi-discover libnss-mdns libavahi-compat-libdnssd-dev
I rebooted the system, just to make sure everything is going, and no change:
debian@bgw00000000:~/prototypeF$ npm start
> prototypef@1.0.0 start
> export $(cat .env | xargs) && nodemon main.js
[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node main.js`
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
-- mDNS: mDNS Advertising as MintonTech
/home/debian/prototypeF/node_modules/mdns/lib/advertisement.js:56
dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
^
Error: dns service error: unknown
at new Advertisement (/home/debian/prototypeF/node_modules/mdns/lib/advertisement.js:56:10)
at Object.create [as createAdvertisement] (/home/debian/prototypeF/node_modules/mdns/lib/advertisement.js:64:10)
at MulticastDNSService.createmDNSAdvertisement (/home/debian/prototypeF/service-mdns.js:31:25)
at new MulticastDNSService (/home/debian/prototypeF/service-mdns.js:24:10)
at Object.<anonymous> (/home/debian/prototypeF/main.js:67:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
errorCode: -65537
}
[nodemon] app crashed - waiting for file changes before starting...
Found this: https://www.truenas.com/community/threads/try-to-run-airsonos-issue-with-registering-on-the-network.36428/
There user @tslw says there are incorrect setting in /usr/local/etc/avahi-daemon.conf enable-dbus was set to not where it should have been yes
Went to https://manpages.debian.org/testing/avahi-daemon/avahi-daemon.conf.5.en.html and discovered the Avahi configuration file is located at /etc/avahi/avahi-daemon.conf. So I pico /etc/avahi/avahi-daemon.conf
and uncommented dbus-enabled=yes
. Save. Reboot the system.
Still no change in result.
Hi,
I'm currently using this module on debian 10 so I should be able to help.
I have encountered this error when a device is registered in avahi (it was found on the local network) but could no longer be resolved (I think it's the job of getaddrinfo
on linux). I know of two reasons for this :
- The device is no longer reachable (it can take a long time for avahi daemon to unregister dead devices)
- your nss configuration doesn't allow mdns resolution
In /etc/nsswitch.conf
you should have a line like :
hosts: files mdns4_minimal mdns6_minimal [NOTFOUND=return] dns
(copied from mine, may vary. The important bit is mdns4_minimal
or mdns4
If you don't care about name resolution, you can customize the name resolution step in mdns to skip it.
Hi I am getting same error as described above. Any updates @cjohnweb ?
My environment is
- Ubuntu 18.04.6 LTS (In WSL 2)
- node version 14.19.0