Lost connection to server, reconnecting in

@Colin, I know it seems odd but at the moment it more or less behaving. I may have copied the entire contents of the .node-red folder over not just the flows as my copy contains the entire .node-red folder.

@dceejay, Thanks for that I'll see how it goes.

IF it starts going wrong again I'll report back - I was almost at the stage of downloading a new install and start over, that probably would have been the best thing to do ...

I confused matters by mentioning nodejs 13 (I have removed that comment since), I was getting mixed up with another very similar thread where nodejs 13 is involved. It is not an issue here however.

Bugger, that was short lived @Colin was correct it was a temporary fix.

I suggest using @dceejay's nuclear option then.
If in doubt a sledge hammer will usually fix things :slight_smile:

I applied @dceejay nuclear sledge hammer but it's showing lost connection .

I have an old image file that I'll have to reload but that has a cryptic filename of BUST-node_red

I'll save the json_raspberrypi.flows and json_raspberrypi_cred.flows files at least then I can get back what I have now flow wise.

1 Like

Have you got rid of all the errors, that is the first thing?

Node-red would start without any errors in the log however, it still had the 'lost connection to server' so I've decided to go back to an on .img file I have - I did make an image of the outgoing node-red though ..

Now that you have got rid of the errors it is just a matter of finding what is causing the hangup, which is usually not difficult, usually it is a lockup in a function node, an mqtt loop or other loop in the logic.

I don't think it was a problem with the flows as I follows @Paul-Reed and removed them Iand I still had the error.

Bit now I'm reflashing an old-er image file I have and copy my flows over to it. But I think that image file has issues which I can't remember what they where ! - as I named it BUST-Node_red.img

My saved image I had doesn't appear to work. I think I'll start over with a fresh install, is Raspbian the best way to go from here https://www.raspberrypi.org/downloads/raspbian/
then run the node-red install script ?

1 Like

Did you try it again with the empty flow file since you nuked it and ran the script? I suspect that you will find it is now ok.

If you want to start from scratch then yes, install raspbian, run
sudo apt update && sudo apt full-upgrade
to get everything up to date and then run the script.

Thanks @Colin, It took me >2.5hrs to download the zip image - slow connection !
It must have been ~7 years ago since I last downloaded an image. Just figured out how to ssh from headless and now just applied the updates then the script.

I had to remember to turn off by hand ! the standard light last night as it's controlled by node-red of this PI.

I there a easy (lazy) way of install the missing nodes ?

14 Apr 10:03:51 - [info] Waiting for missing types to be registered:
14 Apr 10:03:51 - [info]  - ui_group
14 Apr 10:03:51 - [info]  - ui_tab
14 Apr 10:03:51 - [info]  - darksky-credentials
14 Apr 10:03:51 - [info]  - light-scheduler-settings
14 Apr 10:03:51 - [info]  - emoncms-server
14 Apr 10:03:51 - [info]  - position-config
14 Apr 10:03:51 - [info]  - ui_base
14 Apr 10:03:51 - [info]  - bigtimer
14 Apr 10:03:51 - [info]  - e-mail (provided by npm module node-red-node-email)
14 Apr 10:03:51 - [info]  - rpi-ds18b20
14 Apr 10:03:51 - [info]  - ui_gauge
14 Apr 10:03:51 - [info]  - ui_chart
14 Apr 10:03:51 - [info]  - ThingspeakSendSimple
14 Apr 10:03:51 - [info]  - owntracks
14 Apr 10:03:51 - [info]  - schedex
14 Apr 10:03:51 - [info]  - sunpos
14 Apr 10:03:51 - [info]  - light-scheduler
14 Apr 10:03:51 - [info]  - worldmap in
14 Apr 10:03:51 - [info]  - worldmap-tracks
14 Apr 10:03:51 - [info]  - worldmap
14 Apr 10:03:51 - [info]  - openweathermap
14 Apr 10:03:51 - [info]  - ui_text
14 Apr 10:03:51 - [info]  - ui_button
14 Apr 10:03:51 - [info]  - ui_template
14 Apr 10:03:51 - [info]  - timerswitch
14 Apr 10:03:51 - [info]  - Sonoff device
14 Apr 10:03:51 - [info]  - emoncms
14 Apr 10:03:51 - [info]  - ui_switch
14 Apr 10:03:51 - [info]  - ui_slider
14 Apr 10:03:51 - [info]  - lower-case
14 Apr 10:03:51 - [info]  - sentiment (provided by npm module node-red-node-sentiment)
14 Apr 10:03:51 - [info]  - is online
14 Apr 10:03:51 - [info]  - emonpixel-clockwise
14 Apr 10:03:51 - [info]  - emonpixel-background
14 Apr 10:03:51 - [info]  - emonpixel-anticlockwise
14 Apr 10:03:51 - [info]  - blindcontroller
14 Apr 10:03:51 - [info]  - openweathermap in
14 Apr 10:03:51 - [info]  - solar power forecast
14 Apr 10:03:51 - [info]  - time-range-switch
14 Apr 10:03:51 - [info]  - solar power forecast plus
14 Apr 10:03:51 - [info]  - geofence
14 Apr 10:03:51 - [info]  - ui_dropdown
14 Apr 10:03:51 - [info]  - ui_numeric
14 Apr 10:03:51 - [info]  - ui_colour_picker
14 Apr 10:03:51 - [info]  - ui_date_picker
14 Apr 10:03:51 - [info]  - camerapi-takephoto
14 Apr 10:03:51 - [info]  - sun-position
14 Apr 10:03:51 - [info]  - within-time-switch
14 Apr 10:03:51 - [info]  - time-comp
14 Apr 10:03:51 - [info]  - time-inject
14 Apr 10:03:51 - [info] To install any of these missing modules, run:
14 Apr 10:03:51 - [info]   npm install <module name>
14 Apr 10:03:51 - [info] in the directory:
14 Apr 10:03:51 - [info]   /home/pi/.node-red

cd .node-red
npm install

That should install everything specified in package.json

That didn't' do much. I have manually installed all of the nodes however, I installed one incorrect one and I can't remove it.

14 Apr 10:48:10 - [info]
Welcome to Node-RED
===================
14 Apr 10:48:10 - [info] Node-RED version: v1.0.5
14 Apr 10:48:10 - [info] Node.js  version: v12.16.2
14 Apr 10:48:10 - [info] Linux 4.19.97-v7+ arm LE
14 Apr 10:48:12 - [info] Loading palette nodes
14 Apr 10:48:19 - [info] Worldmap version 2.3.5
14 Apr 10:48:19 - [info] Dashboard version 2.20.0 started at /ui
14 Apr 10:48:21 - [warn] ------------------------------------------------------
14 Apr 10:48:21 - [warn] [ttb-node-owntracks/owntracks] Error: Cannot find module '/usr/lib/node_modules/node-red/nodes/core/io/lib/mqttConnectionPool'
Require stack:
- /home/pi/.node-red/node_modules/ttb-node-owntracks/owntracks.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/lib/node_modules/node-red/lib/red.js
- /usr/lib/node_modules/node-red/red.js
14 Apr 10:48:21 - [warn] ------------------------------------------------------
14 Apr 10:48:21 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Apr 10:48:21 - [info] Context store  : 'default' [module=memory]
14 Apr 10:48:21 - [info] User directory : /home/pi/.node-red
14 Apr 10:48:21 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Apr 10:48:21 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
14 Apr 10:48:21 - [info] Server now running at http://127.0.0.1:1880/
14 Apr 10:48:21 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
14 Apr 10:48:22 - [info] Waiting for missing types to be registered:
14 Apr 10:48:22 - [info]  - owntracks



I installed ttb-node-owntracks rather than node-red-contrib-owntracks which no won't remove.

Also the dashboard layouts are gone - that could be because the nodes aren't running ?

Following on from my last where are the dashboards layout details stored, as I thought restoring the flows would have restored the dashboards layouts as well ?

Possibly you probably didn't restore package.json.

You can't remove the node from inside node red because it is in use. You will have to do it from the command line as you have done before

cd .node-red
npm uninstall whatever-it-s
npm install the-right-one

and restart node-red.

The layout is in the flows file. As always fix the problems that you know how to fix and often the problem you don't understand will go away. Not always though.

Your right I didn't restore the package.json file - would it hurt if I did it now ?

It's funny how I forget how to do even the most basic things, having only go into node-red very infrequently - usually a 'major disaster' caused by my own stupidity !

All I did is restore the flows via Import > select file my .json backup file

Thanks for bearing with me anyway !

2020-04-14 12_03_32-Node-RED _ 192.168.2.40

If when following forum replies, things don't work as expected, you may find it beneficial to post and say so, instead of deviating and going your own way.
Numerous times in this thread we've made suggestions, only to find that you've already
jumped ahead & made other changes, and possibly made things more difficult for yourself.
Please don't take this the wrong way :wink:

1 Like

No problem @Paul-Reed I entirely agree with you, I can be a total idiot sometimes not listening and misreading help. Going my own way messing things up.

I think what it is I hate keeping people waiting for a reply and then, them thinking I'm ignoring their help.

1 Like

There is no point if you have already installed the extra nodes.

I don't know what might cause the not configured problem. Open one or them up and see what the problem is. Were you making use of any environment variables, or something that you had setup in settings.js?