Issue Updating n8n Using npm update -g: ENOTEMPTY Rename Error

sudo npm update -g n8n
npm error code ENOTEMPTY
npm error syscall rename
npm error path /usr/lib/node_modules/n8n
npm error dest /usr/lib/node_modules/.n8n-seyU16Gs
npm error errno -39
npm error ENOTEMPTY: directory not empty, rename '/usr/lib/node_modules/n8n' -> '/usr/lib/node_modules/.n8n-seyU16Gs'
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-17T07_40_41_591Z-debug-0.log

I am trying below method for this I am not sure if it will work
sudo rm -rf /usr/lib/node_modules/.n8n-*
sudo npm install -g n8n --unsafe-perm=true
I see this guide talking about same error, if anyone has suggestions can you please mention that.

https://syncbricks.com/update-n8n-safely-using-npm-without-data-loss/

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