You have a problem with your node-red installation as you have installed it as the root user.
This will cause all sorts of issues.
I recommend that you make a copy of /root/.node_red
sudo cp -R /root/.node_red /root/node_red_backup
If this is on Pi, next step is:
sudo chown -r pi:pi /root/node_red_backup
which should reset ownership of the copy to the Pi user (I might be slightly off with that command as it is from memory. Run sudo ls -la /root/node_red_backup
and make sure that the Pi user is actually owner of all of the files and folders.
Now copy that backup to the correct location after getting rid of the unnecessary npm packages
rm -R /root/node_red_backup/node_modules
mv ~/.node-red ~/.node-red-old
cp /root/node_red_backup ~/.node-red
Next, make sure node-red isn't running service stop node-red
then cd @/.node-red
and npm install
. Then run node-red manually and make sure that it is working and using the files in the Pi users home folder and not the root ones.
If you set up node-red to run as a service yourself, make sure that you set the user and group to be a real user as per Dave's install script. Then you should be able to reboot.