URGENT: Site showing 502 Bad Gateway and Ghost won't restart

  • sudo node current/index.js
    internal/modules/cjs/loader.js:905
    throw err;
    ^

Error: Cannot find module ‘/var/www/ghost/current/index.js’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47 {
code: ‘MODULE_NOT_FOUND’,
requireStack:
}

Server operating system? What have you done recently that might be to blame? (Recent upgrade?) Is this the first error message in the logs? (It’s usually the first problem.) Any luck with ‘ghost doctor’ ?

Is that index.js file at that address? If it isn’t, is it supposed to be, or do you have a mismatch between your configuration file and your actual directory structure?

Wait, hang on a second. Normally one starts ghost with ‘ghost start’. What set of directions are you following that you’re starting it this way?

Ghost doctor shows this:

:heavy_check_mark: Checking system Node.js version - found v16.17.1
:heavy_check_mark: Checking logged in user
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_check_mark: Checking if logged in user is directory owner
:heavy_check_mark: Checking current folder permissions
:heavy_check_mark: Checking system compatibility
:heavy_check_mark: Checking for a MySQL installation

  • sudo systemctl is-active ghost_kigalian-com
    :heavy_check_mark: Validating config
    :heavy_check_mark: Checking folder permissions
    :heavy_check_mark: Checking file permissions
    :heavy_check_mark: Checking content folder ownership
    :heavy_check_mark: Checking memory availability
    :heavy_check_mark: Checking binary dependencies
    :heavy_check_mark: Checking free space
    :heavy_check_mark: Checking systemd unit file
    :heavy_check_mark: Checking systemd node version - found v16.17.1

It refused to restart after an upgrade, then I downgraded.