Npm fix inside Node-RED docker container

Hello everybody, I have an issue I'm not able to solve and hope to find some answers here.

I migrated my Node-RED from Armbian to Debian and I imported all the data directory structure from the old instance to the new one. Everything went fine except for the Aedes module which asks to be updated to v0.9.0. The message received when trying the update process is the following:

2022-12-03T19:23:29.630Z [err] npm ERR! Your cache folder contains root-owned files, due to a bug in
2022-12-03T19:23:29.630Z [err] npm ERR! previous versions of npm which has since been addressed.
2022-12-03T19:23:29.630Z [err] npm ERR!
2022-12-03T19:23:29.631Z [err] npm ERR! To permanently fix this problem, please run:
2022-12-03T19:23:29.631Z [err] npm ERR! sudo chown -R 1000:1000 "/data/.npm"

The problem I'm having is that I'm not able to use chown: the image does not contain sudo package and I'm not able to install it with "apk add sudo"

On Docker hub the image maintainer suggests to ask any question about the docker image on this forum so here I am, looking for suggestions on what to do.

Hope to get some help so that I can complete the migration to the new Debian instance.

Thanks and have a nice day,

Welcome to the forum @Virgus

Did you try it without sudo? Alternatively is that folder accessible outside of the container? If so then do it outside.

Not directly related to the problem, but you should consider using mosquitto rather than aedes.

1 Like

Great idea @Colin thanks!
It worked as the concerned path was used as a volume path in docker and I can use chown outside the container. Without sudo, inside the container, I get "permission denied".

I got a step further and now the npm error concerns node.js version which needs to be updated to v14

2022-12-04T09:16:58.020Z [err] ERR! code ENOTSUP
2022-12-04T09:16:58.051Z [err] ERR! notsup Unsupported engine for aedes-persistence-mongodb@9.1.0: wanted: {"node":">=14.0.0"} (current: {"node":"12.22.8","npm":"6.14.15"})
2022-12-04T09:16:58.051Z [err] notsup Not compatible with your version of node/npm: aedes-persistence-mongodb@9.1.0
2022-12-04T09:16:58.051Z [err] npm ERR! notsup Not compatible with your version of node/npm: aedes-persistence-mongodb@9.1.0
2022-12-04T09:16:58.052Z [err] npm ERR! notsup Required: {"node":">=14.0.0"}
2022-12-04T09:16:58.052Z [err] npm ERR! notsup Actual: {"npm":"6.14.15","node":"12.22.8"}

I'm trying to figure out how this could be done, meanwhile if you have other tips to share with me I'll be happy to learn new tricks :slight_smile:


apk add sudo

on debian it is apt install sudo

Hello @bakman2, thanks for your reply.

Debian is the main OS but the Node-RED image is based on Alpine Linux and some commands need to be launched inside the Docker container.

bash-5.0$ cat /etc/os-release
NAME="Alpine Linux"
PRETTY_NAME="Alpine Linux v3.12"

It seems tricky to update node.js inside an Alpine image (hopefully one day I'll learn how to do it) but I've just seen that the Docker hub repository has another image with nodejs 14 !

So I rebuilt everything updating image nodered/node-red:2.2.2-12 to nodered/node-red:2.2.3-14 and everything seems fine as it was before.

Thanks you all for the help and have a nice day,

Why not go to the latest node-red while you are at it?

Thats what you get when you run docker. Just run node red natively and it magically all works.

1 Like

I'm running Docker inside of CasaOS docker manager on an OrangePi Zero 2 SBC.
I'm using MQTT in conjunction with a Tasmota Zigbee Ethernet hub doing quite simple things for now (mainly testing devices and shutters group control via some IKEA's remotes). When I'll have more devices I'll upgrade to ZigBee2MQTT, add Mosquitto and improve the overall setup. This is why Aedes for now is enough for me.

All versions of Node-RED images on docker hub were released four months ago and CasaOS devs choosed v2.2.2-12 amongst all the possible options. I don't know if their choice was based on specific reasons (maybe compatibility issues ?). I wrote them today to let them know that the minimum requirements for using Aedes is v2.2.3-14 so for now I'm just happy that everything is working again.

In any case, upgrading to another version in the future within Docker will be really fast and can be done at any time :slight_smile:

I agree. I didn't like Docker that much until a year ago. Then I discovered its beauty and now I think learning it is worth the time and the effort spent.

I have an OrangePi in every apartment running ZeroTier One, Pi-Hole and a few other essentials tools. Then for complex tasks, only where I really need it, I added a Raspberry Pi 4 booting from SSD. Even if I consider myself still a beginner I can tell that docker is really easy to manage and to maintain, even remotely.

My next goal is to integrate and configure Nginx proxy manager. There's so much to learn !

1 Like

You misunderstand my point.

I like docker (and compose for that matter), I am running a whole bunch of them, together with lxc's (linux containers, some even with docker inside of them, like inception).

A simple node-red installation will run fine in docker, until you need to connect external devices (like usb/serial) and/or need to access files outside the container, you can run into all kinds of issues, while introducing unnecessary overhead of installing an abstracted version of an OS together with all of the packages inside the container, while not solving anything.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.