Failure updating Flowfuse dashboard

I have successfully updated Dashboard 2 to 1.30.0 on a Pi running NR v4.1.0.

On another Pi which runs v5.0.0-beta.1 though, using the updates available button I get a warning

npm error code EACCES
npm error syscall mkdir
npm error path /home/pi/.node-red/node_modules/@node-rs/bcrypt-linux-arm64-musl
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/home/pi/.node-red/node_modules/@node-rs/bcrypt-linux-arm64-musl'
npm error     at async mkdir (node:internal/fs/promises:861:10)
npm error     at async /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:576:20
etc

and error

Error: Install failed
    at /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/installer.js:290:25
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)

Could this be because I installed the beta using sudo npm install ... ?

The first issue looks like it might be sudo related, not sure about the 2nd.

Perhaps you used sudo npm, but forgot the -g, in which case you will now have files owned by root in your .node-red folder. You can sort that by going into your .node-red folder and running
sudo chown -R pi:pi .
Note the dot on the end. That will set the ownership of all files there back to user pi. That should be the correct user as I see you are under the /home/pi folder.

1 Like

And just to reinforce that. This command should always be safe to run.

Of course, if not using a Pi, change the pi:pi to whatever user:group you are using.

1 Like

Yes there were indeed shedloads of root owned files.

When I installed v5 beta I know I omitted --unsafe-perm since it gives a deprecation warning. Must have missed the -g flag too.

Thanks!

If you missed off the -g you may have installed node-red locally into your .node-red folder, which you probably didn't want to do. Check in package.json and see whether node-red appears in the dependencies section. It shouldn't. If it does then, from the .node-red folder, run
npm remove node-red
which will just remove the locally installed one. Then you can run the node red beta install again, this time remembering the -g.

2 Likes

You don't want to install node-red beta globally unless you have a spare device not running the current version.

To run both in parallel, install one or both locally. I always do this anyway for all my installs since it is the more "node.js way" to do things. That is what my alternate installer is about. It creates a new folder (or uses an existing one) to install node-red and creates a data sub-folder and an npm start script that directs the user-dir to the data sub-folder. That way, I know for sure that everything is completely isolated.