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! code ENOTEMPTY
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 ?