Question

Ghost 502 error

Posted October 26, 2016 1.7k views
Ubuntu Ghost

Hi! I got 502 Bad Gateway error when I got done with the Ghost update to 0.11.2

Below is the log file

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/bin/npm', 'start', '--production' ]
2 info using npm@3.10.9
3 info using node@v0.12.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ghost@0.11.2~prestart: ghost@0.11.2
6 silly lifecycle ghost@0.11.2~prestart: no script for prestart, continuing
7 info lifecycle ghost@0.11.2~start: ghost@0.11.2
8 verbose lifecycle ghost@0.11.2~start: unsafe-perm in lifecycle true
9 verbose lifecycle ghost@0.11.2~start: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/var/www/ghost/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
10 verbose lifecycle ghost@0.11.2~start: CWD: /var/www/ghost
11 silly lifecycle ghost@0.11.2~start: Args: [ '-c', 'node index' ]
12 silly lifecycle ghost@0.11.2~start: Returned: code: 1  signal: null
13 info lifecycle ghost@0.11.2~start: Failed to exec start script
14 verbose stack Error: ghost@0.11.2 start: `node index`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at EventEmitter.emit (events.js:110:17)
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at ChildProcess.emit (events.js:110:17)
14 verbose stack     at maybeClose (child_process.js:1008:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
15 verbose pkgid ghost@0.11.2
16 verbose cwd /var/www/ghost
17 error Linux 3.13.0-86-generic
18 error argv "node" "/usr/bin/npm" "start" "--production"
19 error node v0.12.0
20 error npm  v3.10.9
21 error code ELIFECYCLE
22 error ghost@0.11.2 start: `node index`
22 error Exit status 1
23 error Failed at the ghost@0.11.2 start script 'node index'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the ghost package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     node index
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs ghost
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls ghost
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Okay got it fixed, I somehow changed my root password, so had to reset it (DO box gets powered down)

First of all, stop the ghost service:

sudo service ghost stop
cd /var/www/ghost && sudo rm -rf node_modules

This is a good time to run sudo npm cache clean -f, but I didn’t

sudo npm install --unsafe-perm --production

then it should say success, finally:

sudo service ghost restart

Wait 2 mins and your ghost site should be online again!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer
Submit an Answer