"Lost Connection to server" on Ubuntu

#1

Hallo,
installed node-red on a fresh ubuntu 18.04 system:

sudo npm install -g --unsafe-perm node-red

after starting it, I got the error:

"Lost connection to server, reconnecting in ..."

In Javascript console:
red.min.js:16 WebSocket connection to 'ws://node.brantner.loc:1880/comms' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED
r @ red.min.js:16

What did I do wrong or what did I forget?

Thank you, Christian.

0 Likes

#2

Can you post the node-red startup log (That's the output starting "Welcome to node red")

You may be interested to know that on Ubuntu you can install using the Pi install script from https://nodered.org/docs/hardware/raspberrypi which should guarantee you get a consistent set of tools. That is what I always do. If you wanted to do that don't worry about the fact you have already installed it, the script should tidy it up.

0 Likes

#3

Are you running this machine behind any kind of proxy? If so, you must make sure the proxy is configured to allow websocket connections through.

0 Likes

#4

I just tried the script on a fresh 18.04 install. Chose N for "Pi specific nodes" it failed at the install node.js LTS step.

I had installed build essentials and some other development tools. From the log files it looks like npm is not installed. Perhaps the script should apt-get install npm if not on a Pi?

It seems to have installed fine when repeated after installing npm (which brings in a lot of stuff on Ubuntu-Mate 18.04)

0 Likes

#5

Can you post the install log please from the failing run please. It should still be in the file unless you deleted it. There must be some condition not coped with.

0 Likes

#6

which version of node.js did it install ?

0 Likes

#7

I'm sorry, it got over-written by the successful install after I installed npm. Actually it seems to have appended, but the very start of the file doesn't look quite right. nodered-install.log.txt (22.6 KB)

I've ended up with npm --version 3.5.2 and nodejs --version 8.10.0 on this Ubuntu 18.04 system.

I haven't done anything with it yet other than manage pallet to add the dashboard, seems to have worked.

0 Likes

#8

The weirdness is that it says it installed nod from https://dl.bintray.com/resin-io/debian stable Release: which would indicate it didn't use the correct nodejs version. Indeed 8.10.0 that you now have is slightly backlevel also...

How did you get nodejs installed ? the links from the nodejs site take you to


We still recommend the 8.x version (though 10.x should also work fine... but please don't use 11.x yet)

That should get you node 8.12.0 and npm 6.4.1 I think (as of 14th Nov 2018)

0 Likes

#9

I used the script with the curl command cut and pasted from the Raspberry Pi installation page:
https://nodered.org/docs/hardware/raspberrypi

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

I re-ran the script a third time and it says: Leave Existing Node v8.10.2 Npm 3.5.2 I was hoping maybe it'd pull in the "correct" versions. Seems not.

I'm really hoping this snap/docker/appimage stuff works out and one format can dominate. With TB hard drives in the end-caps at MicroCenter for $25, IMHO the savings from using shared libraries are not worth hassles of library and subsystem versionitis incompatibilities.

0 Likes

#10

Is that correct? I see
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 nodejs amd64 8.10.0~dfsg-2ubuntu0.4

But I am wondering whether this is actually the problem:

W: GPG error: https://dl.bintray.com/resin-io/debian stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 379CE192D401AB61
E: The repository 'https://dl.bintray.com/resin-io/debian stable Release' is not signed.
Error executing command, exiting

Did that mean that it exited the command before setting up the nodejs repo?
@wb666greene could you sort out that error (either get the key for bintray or disable that repository), uninstall nodejs and try the script again?
Before running the script run
sudo apt update && sudo apt full-upgrade
to make sure all packages are up to date that there are no other problem with your repositories.

0 Likes

#11

We do now have a snap version as well. Of course you need to stop the existing one as it also uses port 1880 by default ( but can be changed)

0 Likes

#12

Interesting, initially while checking out Mate's "software boutique" I tried to install Etcher SD/USB imager and it failed for lack of the key. I thought it a bug in the boutique. I didn't really need Etcher on this system so I ignored it after posting a message about the error on the Ubuntu Mate forum.

I've removed the repo from software sources, did apt-get remove nodejs, and re-ran the script, now I get a popup saying npm update check failed and something I really don't understand about a local update config store with a recommended sudo command. So I did the command.

Looks like I now have nodejs 8.12.0 and npm 6.4.1

Thanks, I don't think it really mattered for my purposes, but I'm happy to try and help out so that the process can be improved such that non-apprentice gurus can expect it to work.

0 Likes

#13

Did you do the apt update && full-upgrade command first?

0 Likes

#14

I will likely move to the snap eventually, but I wanted this system to be as similar to my Raspbian Stretch setup as practical.

I have a nodejs program, that depends on some non-standard npm installed contrib libraries, which scans the network for the URLs of Onvif network cameras. If I spawned it using an exec node with node-red running in a snap, would that external command still work? On the other hand I only need to run the command when cameras are changed so it'd be more "natural" to run it outside of node red. Would I then have to install a "parallel" nodejs and npm using apt-get to do so?

Finding out some time in the future, after I've long forgotten these details, that moving a command that has worked well externally into the snap node-red flow as part of some "upgrade" I dream up stopped working would be a real bummer and a factor against using snaps.

I'm thinking out loud as I don't yet appreciate the restrictions of using snaps although they are starting to sound like the holy grail to me :slight_smile: if my speculation of a potential issue mention above is unfounded I'll look into the snap version sooner rather than later.

0 Likes

#15

Well we are all learning about snaps so yes it would be a good thing to test/try. One of the things they do have in the pipeline (1Q19 hopefully) - is the ability to base one snap on another (more dependencies yay,,,, :slight_smile: - so you could take our Node-RED snap and add your own extras and customisations to it.

Anyway - back to today - is the external command something we can try ?

0 Likes

#16

Sure if you have an Onvif camera for it to find. Its pretty simple and bare bones, I'm a javascript newbie. It requires node-onvif (contrib, there are two with similar names) and fs, which I think is part of the installation.

I've attached it, rename to remove the .txt added so I could upload it, and run with nodejs onvif_discover.js
onvif_discover.js.txt (4.3 KB)

I've never actually ran it with no cameras so it could die horribly.

Its purpose it to make a list of the camera URLs and write it to a file, which my Python AI script loads on startup. This Python script is launched by node-red exec via a shell script which sets up some log files and starts the Python code.

I couldn't make heads or tails with the Python onvif module so I used nodejs, which I need to learn more about so this was a good place to start.

0 Likes

#17

Thank you knolleary, the proxy was the problem. Greetings, Christian.

0 Likes