Pls help: Node Red will not start / Backups seems to be damaged

I ve a big big problem.
After I added a big flow my node red (ioBroker implemented but never used) lost connection.
Now it does not start anymore. I ve no idea where to find the error logs. My backup stick seems to be
damaged. the raspy runs fine only NR does not start. I ve spend month to code. Pls help ! - Thx !

what command are you using to start NR

Maybe some more info about your environment, Operating System, Version, platform etc etc

Craig

A little update: I managed to get my backup working and found out that when I use the flow.json of the backup it will start again ... phew. But still frustraiting to lose 1 week of work. Is there a way to repair / check the flow.json for errors ?

EDIT: When using a service like https://jsonlint.com/ or equal the flwos.json semms to be okay. but its not working :frowning:
Is there a backup folder or so for these file ?

btw. I am running it on a raspi 3B+


raspberrypi

Platform
    linux
Architecture
    arm
CPUs
    4
Speed
    1200 MHz
Model
    ARMv7 Processor rev 4 (v7l)
RAM
    926.08 MB
System uptime
    00:20:05
Node.js
    v10.16.2 (There is a newer version: v10.17.0)
NPM
    6.9.0
Disk size
    29.03 GB
Disk free
    18.69 GB
Adapters count
    260
Uptime
    00:20:01
Active instances
    12
Hostname
    raspberrypi

Assuming you used the recommended install technique for the pi then put the old flow back and in a terminal run
node-red-stop
node-red-start

and check the log that appears. If anything looks wrong then post the log here (copy/paste if possible please rather than screenshot). If it looks ok but you are not able to get into the editor then run

node-red-stop
node-red --safe

that will start node red without starting the flows which should enable you to get into the editor and remove the offending nodes.

I am no expert an linux but the commands "node-red-stop" / " node-red-start" are unknown. I think this has to do with ioBroker managing the instances and putting installations to a custom dir. (/opt/iobroker/iobroker-data/node-red). at least 'sudo find -name "node-red-stop"' over the hole disc gave no result.

I missed that fact that you were using the iobroker install. Well however you normally stop and start node-red in a terminal do that instead of node-red-stop and start.

Where are the logs for node-red ? maybe I can see whats going on / wrong while starting ?

Node-RED itself just writes its log output to stdout - where that gets redirected to will depend on how iobroker has installed it.

How do you run node-red? What command do you use?

iobroker starts it automatically as an instance ... I have a gui for all instances iobroker is running.
but I cant get details for start methods there. it looks like this:

(start & stop / settings (port,user,password..etc) / reload / delete / openwebpage)

Then you need to ask iobroker how they expose the logs etc.

I found something:

2019-11-20 16:39:18.015  - e[31merrore[39m: node-red.0 20 Nov 16:39:18 - [error] [file in:ReadFile] Error: ENOENT: no such file or directory, open '/home/pi/logs/lastCommands.log'

2019-11-20 16:39:18.020  - e[31merrore[39m: node-red.0 20 Nov 16:39:18 - [error] [file in:ReadFile] Error: ENOENT: no such file or directory, open '/home/pi/logs/lastCommands.log'

2019-11-20 16:39:24.343  - e[33mwarne[39m: node-red.0 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

2019-11-20 16:39:24.424  - e[32minfoe[39m: node-red.0 node-red exited with null

JavaScript heap out of memory ... <- hmmm, how can I fix this ?

Well, this may be a dumb question but is there a way to give javascript more memory.
Some flows have about 140 nodes.... When I coped them to expand the project for a new light switch node red often lost connection. Raspi has only one GB maybe thats to less for iobroker and a instance of node-red with many flows.

Ok, Problem solved.
The raspi an out of memory (RAM). I had iobroker with different modules installed what eats much of the ram. Solution goes like this (port node-red from iobroker) :

  1. copy this form / iobroaker / iobroker-data / node-red to a safe space
  2. make a fresh installation of node-red with MQTT and stuff you need.
  3. stop node-red.
  4. go to node red installation directory overwrite:
    node-red / node_modules with your copy / iobroaker / iobroker-data / node-red / node_modules
  5. replace files in node-red dir with your copy: package.json, package-lock.json
    rename flows.json to flows_raspberrypi.json and overwrite it.
  6. start node-red and join changes, look out for missing flows / nodes ... aso and install if needed.
    This worked for me. If you made changes like in settings.json or so it might take additional work to import changes. No garantuie that it will work for you.

There are different explains for node-red files around which might be usefull (google it)
(eg: https://github.com/node-red/cookbook.nodered.org/wiki/How-to-backup-flows-and-related-configuration)