Can't start Ghost after update

Hello,

I’m running a 1-Click Ghost droplet on Digital Ocean. It has been running but was out of date so I did an update which went smoothly. Unfortunately, now Ghost refuses to start.

I am using Ghost-CLI 1.9.9 and Ghost is currently at v2.14.3.

I can sudo to ghost-mgr (the user that Digital Ocean sets up for running ghost commands on the CLI). But when I do ghost restart or ghost start or ghost run I get:

ghost-mgr@br-2:/var/www/ghost/current$ ghost restart
Ghost-CLI commands do not work inside of a git clone, zip download or with Ghost <1.0.0.
Perhaps you meant `grunt restart`?
Otherwise, run `ghost restart` again within a valid Ghost installation.

I can confirm I am in the correct dir (via ghost ls).

When I attempt to restart npm I get the following:

ghost-mgr@br-2:/var/www/ghost$ npm restart

> ghost@3.4.0 start /var/www/ghost
> node index

module.js:549
    throw err;
    ^

Error: Cannot find module 'ghost-ignition'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/www/ghost/index.js:5:13)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

npm ERR! Linux 4.15.0-76-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "restart"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! ghost@3.4.0 start: `node index`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ghost@3.4.0 start script 'node index'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ghost package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ghost
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ghost
npm ERR! There is likely additional logging output above.

FWIW - I already tried:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash
sudo apt-get install -y nodejs
ghost update --force

but the ghost update --force gives me the same error as above:

ghost-mgr@br-2:/var/www/ghost$ ghost update --force
Ghost-CLI commands do not work inside of a git clone, zip download or with Ghost <1.0.0.
Perhaps you meant `grunt update`?
Otherwise, run `ghost update` again within a valid Ghost installation.

Any ideas what I can do please? Thank you

Can you run ls -al /var/www/ghost and share the output?

1 Like

Thank you kindly for the reply @vikaspotluri123. Here is the output:

drwxrwxr-x 7 ghost-mgr ghost-mgr   4096 Feb  5 01:57 .
drwxrwxr-x 4 root      root        4096 Feb  4 17:31 ..
-rw-r--r-- 1 ghost-mgr ghost-mgr     96 Feb  5 01:47 .ghost-cli
-rw-r--r-- 1 ghost     ghost      23682 Jan 28 17:23 Gruntfile.js
-rw-r--r-- 1 ghost     ghost       1065 Jan 28 17:23 LICENSE
-rw-r--r-- 1 ghost     ghost        451 Jan 28 17:23 MigratorConfig.js
-rw-r--r-- 1 ghost     ghost       3095 Jan 28 17:23 PRIVACY.md
-rw-r--r-- 1 ghost     ghost       5071 Jan 28 17:23 README.md
-rw-r--r-- 1 ghost     ghost        610 Sep 13 00:19 config.production.json
drwxr-xr-x 9 ghost     ghost       4096 Feb  4 17:32 content
drwxr-xr-x 6 ghost     ghost       4096 Jan 28 17:37 core
lrwxrwxrwx 1 ghost     ghost         30 Feb 19  2019 current -> /var/www/ghost/versions/2.14.3
-rw-r--r-- 1 ghost     ghost       1060 Jan 28 17:23 index.js
drwxr-xr-x 3 root      root        4096 Feb  4 17:33 node_modules
-rw-r--r-- 1 ghost-mgr ghost-mgr   3327 Feb  5 01:48 npm-debug.log
-rw-r--r-- 1 ghost     ghost       5082 Jan 28 17:23 package.json
-rw-r--r-- 1 ghost     ghost        587 Jan 28 17:23 renovate.json
drwxr-xr-x 4 ghost     ghost       4096 Feb 19  2019 system
drwxr-xr-x 3 ghost     ghost       4096 Feb 19  2019 versions
-rw-r--r-- 1 ghost     ghost     386330 Jan 28 17:23 yarn.lock

So the problem is you have a lot of files and folders that shouldn’t be there:

Gruntfile.js
LICENSE
MigratorConfig.js
PRIVACY.md
README.md
core
index.js
node_modules
npm-debug.log
package.json
renovate.json
yarn.lock

Did you do anything that caused these files to show up? It looks like you might have accidentally cloned ghost from their github repository.

1 Like

That’s odd. All I did was a wget of the latest version and then install. Is there anything I can do to clean things up?

That’s not how you’re supposed to update ghost :grimacing: all you need to do is run ghost update!

My suggestion is to make a folder called __maybe_delete__ in /var/www/ghost, and move the files I listed there. Then try running ghost update

1 Like

That helped a little, thank you. I was able to move everything except /core (permission denied). I ran ghost update anyway and got this:

ghost-mgr@br-2:/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_www-bogdanraczynski-com
✔ 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: v8.10.0
    Ghost-CLI Version: 1.9.9
    Environment: production
    Command: 'ghost update'

Additional log info available in: /home/ghost-mgr/.ghost/logs/ghost-cli-debug-2020-02-05T02_56_36_344Z.log

running ghost update --v1 worked fine:

ghost-mgr@br-2:/var/www/ghost$ ghost update --v1
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_www-bogdanraczynski-com
✔ 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
All up to date!

but I am still stuck on v2.14.3 and am trying to move to v3.x

ghost doctor checks out fine:

ghost-mgr@br-2:/var/www/ghost$ ghost doctor
✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_www-bogdanraczynski-com
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability

any ideas please? Thank you kindly

Yep! You need to be on the latest version of ghost-cli which added support for Ghost v3:

sudo npm i -g ghost-cli@latest

1 Like

Thank you. That installation worked, but then another snag when I ran ghost update again:

ghost-mgr@br-2:/var/www/ghost$ ghost update
+ sudo systemctl is-active ghost_www-bogdanraczynski-com
✖ 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
One or more errors occurred.

1) Checking system Node.js version

Message: The version of Node.js you are using is not supported.
Supported: ^8.16.0 || ^10.13.0 || ^12.10.0
Installed: 8.10.0
See https://ghost.org/faq/node-versions/ for more information

Debug Information:
    OS: Ubuntu, v18.04.1 LTS
    Node Version: v8.10.0
    Ghost Version: 2.14.3
    Ghost-CLI Version: 1.13.1
    Environment: production
    Command: 'ghost update'

Any pointers please? Thanks kindly

It looks like your node version is out of date. Can you run node -v please? You might have multiple versions of node installed,as the output suggests you’re on an old version of node 8.x

1 Like

Seems I’m on v8.10.0. I’m sorry, I would Google the best way to update it, but now I’m worried I bugger up Ghost. What would you suggest please?

Thank you!

# Set up node.js 12 (latest LTS version)
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
# Since you already have node.js installed, you need to _upgrade_ it rather than install it
sudo apt upgrade -y nodejs
1 Like

hmm…

...
E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting

Have you tried to install yarn in the past? It looks like there was a problem fetching the yarn package info

1 Like

Here is the full result of the curl command you suggested:

ghost-mgr@br-2:/var/www/ghost$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

## Installing the NodeSource Node.js 12.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 http://mirrors.digitalocean.com/ubuntu bionic InRelease
Hit:2 https://repos.insights.digitalocean.com/apt/do-agent-beta main InRelease                                                                       
Hit:3 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease                                                                                
Get:4 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]                                                                                       
Hit:5 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease                                                                              
Get:6 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                                          
Err:4 https://dl.yarnpkg.com/debian stable InRelease                                                                               
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
Hit:7 https://deb.nodesource.com/node_6.x bionic InRelease                     
Reading package lists... Done                       
W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting

I am not too sure what’s happening. :confused:

So what happened with the curl command is you fetched the node install script and executed it. The problem you’re running into has to do with the installation script. It runs apt update, which causes the package manager to go to every source it knows and update the list of available packages + their versions. This is how your OS will know about the new version of node. The package lists are signed to prevent malicious actors from adding their own data to the lists. You have a node v6 source in your list, but the signing key used is not available, and you have a yarn source which is not signed at all for some reason. Fixing these issues would require to edit your package sources, which I don’t really recommend for people that aren’t comfortable with the terminal

1 Like

Thanks for all your help thus far! It’s greatly appreciated.

That all makes sense. I am comfortable with the terminal, just not hugely experienced with node/npm. Would you have any pointers on what file(s) need to be edited specifically please? This is just a simple digital ocean droplet and it wouldn’t be the end of the world if I had to start from scratch. I did do an export of my Ghost blog, but it’s unclear to me if that exported only my blogs or my settings as well. So if I can avoid starting from scratch I’d prefer that. But I understand if it’s inconvenient / too time-consuming for you to help.

Thank you kindly either way. :slight_smile:

Take a look at the files in /etc/apt/sources.list.d/. If you’re not using yarn (make sure it’s not installed as well), you can comment out the yarnpkg source. Also make sure to comment out the source that has node 6.x in it

1 Like

Thank you. It appears that yarn is installed. In which file do I comment things out please?

root@br-2:/etc/apt/sources.list.d# ls -la /etc/apt/sources.list.d
total 28
drwxr-xr-x 3 root root 4096 Feb  5 14:20 .
drwxr-xr-x 6 root root 4096 Feb 28  2019 ..
-rw-r--r-- 1 root root   72 Feb 28  2019 digitalocean-agent.list
drwxr-xr-x 2 root root 4096 Feb  5 14:20 node_modules
-rw-r--r-- 1 root root  110 Oct  4  2018 nodesource.list
-rw-r--r-- 1 root root   47 Oct  4  2018 yarn.list
-rw-r--r-- 1 root root   86 Feb  5 14:20 yarn.lock

It looks like something ran yarn install in that folder… the yarn.lock and node_modules folder shouldn’t be there. The yarn source is probably in the yarn.list file. You can add a # to any line to make it a comment

1 Like