Updating Ghost CLI to get Ghost v3

Currently trying to get Ghost v3 installed but failing at the first hurdle of trying to update Ghost CLI.

root@ghost-s-1vcpu-1gb-lon1-01:~# cd /var/www/ghost
root@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost# npm install -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ ghost-cli@1.12.0
added 383 packages from 191 contributors in 17.895s
root@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost# ghost version
Ghost-CLI version: 1.11.0
Ghost version: 2.33.0 (at /var/www/ghost)
root@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost# sudo -i -u ghost-mgr
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:~$ cd /var/www/ghost
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost$ ghost update
You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.

+ sudo systemctl is-active ghost_142-93-46-153
✔ Checking system Node.js version
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking for available migrations
✖ Checking for latest Ghost version
A CliError occurred.

Message: You are about to migrate to Ghost 2.0. Your blog is not on the latest Ghost 1.0 version.
Help: Instead run "ghost update --v1".

Debug Information:
    OS: Ubuntu, v18.04
    Node Version: v10.16.3
    Ghost-CLI Version: 1.11.0
    Environment: production
    Command: 'ghost update'

Additional log info available in: /home/ghost-mgr/.ghost/logs/ghost-cli-debug-2019-10-22T17_30_26_060Z.log

Try running ghost doctor to check your system for known issues.

You can always refer to https://docs.ghost.org/api/ghost-cli/ for troubleshooting.
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost$ npm install -g ghost-cli@latest
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/ghost-cli
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules/ghost-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/ghost-cli'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/lib/node_modules/ghost-cli']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/lib/node_modules/ghost-cli\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules/ghost-cli' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ghost-mgr/.npm/_logs/2019-10-22T17_31_11_809Z-debug.log
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost$ logout
root@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost# npm install -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ ghost-cli@1.12.0
updated 1 package in 9.814s
root@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost# ghost version
Ghost-CLI version: 1.11.0
Ghost version: 2.33.0 (at /var/www/ghost)
root@ghost-s-1vcpu-1gb-lon1-01:/var/www/ghost# 

Not needed up update CLI for a while so am a bit out of touch with the errors etc. Any help would be grand!

Have updated to Ghost 2.37.0 easily enough.

What is the output of which ghost? This tells your where your system is looking for the ghost program, it could be that when you are npm install -g ghost-cli@latest it is not overwriting your existing install

which ghost

gives

/usr/local/bin/ghost

It looks like the order of commands might be off, try making sure you’re the correct user before doing any upgrades:

sudo -i -u ghost-mgr
sudo npm install -g ghost-cli@latest
ghost version
1 Like

Thanks Hannah, I’ve given that a try but still no luck :cry:

root@ghost-s-1vcpu-1gb-lon1-01:~# sudo -i -u ghost-mgr
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:~$ sudo npm install -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ ghost-cli@1.12.0
updated 1 package in 10.136s
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:~$ ghost version
Ghost-CLI version: 1.11.0
ghost-mgr@ghost-s-1vcpu-1gb-lon1-01:~$ 

You can see in your logs that it’s being installed to /usr/bin/ghost and /usr/local/bin/ghost is taking preference.

You could update your PATH so that /usr/bin/ is before /usr/local/bin/ but that will have more global consequences.

Another option is to delete the ghost program which you’re not using from /usr/bin/local/ghost

If you’re worried about deleting things - you can run alias ghost=/usr/bin/ghost which should get you going for now - but you’ll still need to find a solution for removing the old version and correctly pointing to the new version

Hello, I have a problem starting Ghost, after the update, on Windows, locally.

This is the error.log:

Debug Information:
    OS: Microsoft Windows, v10.0.18362
    Node Version: v10.16.1
    Ghost-CLI Version: 1.12.0
    Environment: development
    Command: 'ghost start'
Message: insert into `posts_meta` 

##TONS OF QUERY ....

SQLITE_ERROR: too many SQL variables
    at ChildProcess.cp.on (C:\Users\USER\AppData\Roaming\npm\node_modules\ghost-cli\lib\utils\local-process.js:63:35)
    at ChildProcess.emit (events.js:198:13)
    at emit (internal/child_process.js:832:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

EDIT
A clean new installation is working properly

I got the same error initially but it is solved by simply updating ghost-cli first.
You need to have the latest ghost-cli installed to update to Ghost 3.

npm install -g ghost-cli@latest

Then, a simple ghost update will do the rest.

Yeah… for some reason ghost-clibeon’t update though :frowning:

I had already done the ghost-cli upgrade, unfortunately I didn’t solve the problem