I'm experiencing a weird behavior trying to re-install NR on my Raspbery Pi 3 running Raspbian 9.4 (Stretch).
After a power fault (mains), RPi booted and NR was not working so I tried to fix it manually but messed it up and ended running the install script as described here: https://nodered.org/docs/hardware/raspberrypi
After I run the script, I get the following errors:
Odd one. Can you manually remove that /root/.npm directory. Re-run the bash scipt - and report the install log that it writes to if or when it fails again ?
I have this at /: drwx------ 6 root root 4096 Oct 7 21:35 root
then if I run rm -rf /.npm as pi user I get (as expected) rm: cannot remove '/root/.npm': Permission denied
So I do sudo -i, try rm -rf /root/.npm and I get rm: cannot remove '/root/.npm/_cacache/index-v5/b1/60': Permission denied
Now, I try to list the files in that directory with ls _cacache/index-v5/b1/60/ and I get: ls: cannot open directory '_cacache/index-v5/b1/60/': Permission denied
Permissions are as follows: dr-xr-xr-x 3 pi pi 4096 Aug 21 11:10 . drwxr-xr-x 3 pi pi 4096 Oct 9 17:44 .. drwxr-xr-x 2 pi pi 4096 Feb 17 2010 60
You might notice directory "60" creation(?) date is Feb, 17 2010
Strange disk permissions on a pi have in my experience been the first sign of a dying sd card.
My suggestion would be to copy any files you want if it and then replace it.
well it may have just been corrupted by the power blip - so it may be possible to recover it. try creating a blank file in the / (root) of the card by sudo touch /forcefsck then shutdown and reboot - this will force a file system check on reboot. Hopefully you will then be able to delete that file... s
Second best would be to reformat the whole card and re-image it... (after saving off anything you can - maybe the .node-red directory with your flows in.. )
It is worth using good cards, not cheap unbranded ones. In addition if you get to the point where you have everything installed and basically working then take an image backup of the card. Then you can easily get back to that point just by restoring the image. In addition if you use the Projects feature then you just need to restore the image and fetch the latest version of the project from the repository and you are back up and running.
I use clonezilla (which strictly is not an image backup as it is compressed).
If you google for
sd card image
you will see many other ways of doing it.