Cannot update n8n successfully


I am running n8n on a Raspberry Pi Zero w 2 with Raspbian Lite.

n8n is running inside pm2.

I am really happy with my setup but every time I have tried to update, using

npm update -g n8n

The update fails to complete, or at least the ssh windows does not respond and I cnanot start another ssh session.

I have to leave it for a few hours (during which the disk activity light seems to flash and then flicker constantly) and then pull the plug.

Starting up again, I cannot load n8n in the browser. According to

pm2 status n8n

n8n is running but at 100% or even 200% CPU.

If I uninstall n8n and try to install again, that installation never completes.

So I have to restore a clone of my SD card each time I try to update n8n!

Seems I will be stuck on my current version.

It feels like an issue specific to my environment but can anyone offer any insight?

Presumably you have already stopped n8n using pm2 stop n8n before running npm install -g n8n@latest?

Are you by any chance doing anything else on your Raspi that might drive up CPU usage to unsustainable levels here? I am asking because I am running n8n with a very low CPU load (besides several other services consuming a lot more CPU power), though I am using a Pi 4 rather than a Pi Zero.

Another thing you might want to try would be to check whether your database might be the culprit here. If you are using a rather old version of n8n with SQLite, you might need to manually delete data as described in this thread (since a bug would have prevented automatic deletion of old executions from working as expected):

I forgot to add that step in my note, but I did stop pm2 first.

It’s a brand new Zero 2 W and the processor does not stumble while n8n is running normally, just when/after I try to update.

My version is 0.152.0, so I am almost right up to date. This was the version I installed when I made a clean install last week.

Hm, that’s odd. I suppose the machine might struggle with the npm install command seeing it has very limited resources, but unfortunately I don’t have it here so can’t test this first hand.

Would you be able to run npm in verbose mode (npm install -g n8n@latest -dd) to get an idea of what happens before it dies for you?