Cannot update Ghost CLI - Error Code ENOTEMP - Rename?TY

Self-hosted ghost on Digital Ocean Droplet. I’m trying to update the Ghost CLI but I am receiving the following error:

/var/www/ghost$ sudo npm install -g ghost-cli@latest
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/ghost-cli
npm ERR! dest /usr/lib/node_modules/.ghost-cli-no3HtXlj
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/lib/node_modules/ghost-cli' -> '/usr/lib/node_modules/.ghost-cli-no3HtXlj'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ghost-mgr/.npm/_logs/2021-08-27T22_33_03_748Z-debug.log

I tried renaming ‘/usr/lib/node_modules/ghost-cli’ to ‘/usr/lib/node_modules/.ghost-cli-no3HtXlj’ as it says, but that did not work. Now I cannot rename the folder back to ‘ghost-cli’ and I still receive the error.

Does anyone know how to resolve this issue? I would very much appreciate any help!

Is there any solution to this problem. I am also having the same issue.

@adtechexplained @Piyush_Ranjan did you manage to get this resolved? am having the same issue

hello there, I have the same issue @Paul2 @adtechexplained @Piyush_Ranjan
any help is welcome ! how did you solve it ?

The solution is to delete you ghost CLI folder and then re install it

Are you logged in as ghost-mgr? Try running the update command as root user. I got a similar error when I tried updating the CLI as ghost-mgr

No I was logged as root. I found the solution by manually deleting the ghost CLI folder and reinstall it after.

Hello there, I still get this problem at each update, I need to manually delete Ghost CLI to be able to update.
It quite time consuming. I do not find the solution to this problem. How did you solve it ?

Has anyone figured out a fix for this? It’s still showing up for me every time I try to update the Ghost CLI.

1 Like

I still have the problem too and although I have mentioned it several times to the Ghost team, no one has answered me and no one has investigated this bug which affects several people who host at Digital Ocean.

How can we make sure that our problem is taken into account?

I just tried doing my first update after a DO backup. My update was from Ghost 5.2 to the latest 5.33. I had some dependencies problem before doing the update, but solved with Ghost-Doctor.

The update went smoothly without the aforementioned problems. Maybe it’s because I setup my droplet with the swap? We’ll never know.

To update the droplet is not enough to:

sudo -i -u ghost-mgr.

First I need to go in the Ghost folder:

cd /var/www/ghost/

Only after that I can start checking the update and updating thanks to ghost-help.