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
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.
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)
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.
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.
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)
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.
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.
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.
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 if my speculation of a potential issue mention above is unfounded I'll look into the snap version sooner rather than later.
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,,,, - 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 ?
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.