Cannot uninstall or update ghost-cli locally due to previous version

Hello friends,

I’m not a developer, trying to install a fresh instance of Ghost v5.87.3 locally (mac os sonoma 14.3) so I can play with adjusting my theme.

  • When I run ghost -v I get back Running in development mode Ghost-CLI version: 1.24.2
  • When I run sudo npm install ghost-cli@latest -g and then ghost -v I still get back Running in development mode Ghost-CLI version: 1.24.2
  • When trying to install ghost, I get back Ghost v5.87.3 is not compatible with this version of the CLI. Your CLI version is 1.24.2, but Ghost v5.87.3 requires ^1.26.0

It seems that there are two versions of the ghost-cli installed b/c:

  • If I run: whereis ghost , I get back: ghost: /Users/homefolder/.nvm/versions/node/v18.20.4/bin/ghost
  • After attempting to uninstall ghost-cli with sudo npm uninstall -g ghost-cli, I get back: up to date in 246ms. Then running: whereis ghost, I get back: ghost: /usr/local/bin/ghost

yarn commands are not found, but I have some hidden files that look like yarn, and found at least one previously installed instance of ghost installed locally.

How can I uninstall ghost-cli and fully purge previous local installations of ghost, yarn, etc? I want to start from scratch with npm and am not attached to previous local builds as my self-hosted site is online and running beautifully.

Was thinking @vikaspotluri123 might be able to help.

Thanks in advance!

It seems that you need to remove conflicting versions of Ghost CLI.

See this solution to similar issue:

ChatGPT helped me fix this:

To fully uninstall Ghost-CLI, purge previous installations of Ghost, yarn, and start fresh, follow these steps:


1. Identify the Ghost-CLI Installations

You’re seeing multiple Ghost-CLI versions likely because of separate Node.js environments (via nvm) and globally installed binaries.

Check all Ghost-related installations:

Run the following commands:

bash

Copy code

which ghost
whereis ghost
npm list -g --depth=0 | grep ghost-cli

This will show where ghost is installed and if there are multiple versions of ghost-cli.


2. Uninstall Ghost-CLI Everywhere

Use the following commands to uninstall Ghost-CLI across all environments:

From the global npm install:

bash

Copy code

sudo npm uninstall -g ghost-cli

From your nvm environment:

bash

Copy code

nvm use <node_version> # Use your active Node.js version in nvm
npm uninstall -g ghost-cli

Check if ghost is still available:

bash

Copy code

which ghost

If ghost still appears, delete the binary manually (see below).


3. Delete Ghost Binaries

If ghost is still found after uninstalling:

Delete manually from /usr/local/bin:

bash

Copy code

sudo rm /usr/local/bin/ghost

Delete manually from nvm:

bash

Copy code

rm -rf ~/.nvm/versions/node/v*/bin/ghost

4. Clean Yarn (if Installed)

Even though Yarn commands are not found, check for leftover Yarn binaries or configurations:

Remove Yarn Globally:

bash

Copy code

sudo npm uninstall -g yarn

Remove Yarn Directories:

bash

Copy code

rm -rf ~/.yarn
rm -rf ~/.config/yarn

5. Delete Previous Ghost Instances

Check for leftover Ghost installations:

Common Ghost Directories:

bash

Copy code

rm -rf ~/ghost
rm -rf ~/.ghost

If Ghost was installed somewhere else, locate those installations:

bash

Copy code

find ~/ -name 'ghost*' -type d

Delete any directories related to Ghost.


6. Clean npm Cache

Ensure no stale npm files interfere with a fresh installation:

bash

Copy code

npm cache clean --force

7. Reinstall Ghost-CLI

Reinstall the latest Ghost-CLI:

bash

Copy code

sudo npm install ghost-cli@latest -g

Verify the version:

bash

Copy code

ghost -v

It should now show the correct version (e.g., 1.26.x or higher).


8. Install Ghost Locally

Navigate to your desired project directory:

bash

Copy code

mkdir my-ghost-test && cd my-ghost-test
ghost install local

9. Verify the Local Ghost Installation

Start your local Ghost instance:

bash

Copy code

ghost start

Access it via http://localhost:2368.