Search code examples
pm2

pm2: unknown option `--run-as-user'


I'm following a tutorial on working with git and ghost and they use pm2 to manage the ghost process, but after I do local changes and push them with git push web I get error:

pm2: unknown option `--run-as-user'

These are the contents of my hooks/post-receive file:

#!/bin/sh
export NODE_ENV=production
GIT_WORK_TREE=/var/www/ghost git checkout -f

cd /var/www/ghost
pm2 kill
npm install --production
chown -R ghost:ghost /var/www/ghost
pm2 start index.js --run-as-user ghost --name ghost # THIS MIGHT BE DEPRECATED

Solution

  • The --run-as-user option was removed in 0.12.0 version. Use -u or --user e.g

    pm2 start index.js -u ghost --name ghost