I finally got a pm2 grunt job. just use /usr/bin/grunt as the start of the script, and pm2 works well, the argument is passed by the args section.
Here is my config.json config file. (I am using pm2 deployment)
{ "apps" : [{ "name" : "myapp", "script" : "/usr/bin/grunt", "args" : "['serve:dist']" }], "deploy" : { "production" : { "user" : "user-name", "host" : "server-address", "ref" : "origin/develop", "repo" : "git-url", "path" : "/opt/deploy", "post-deploy" : "npm install && bower install && pm2 startOrRestart ecosystem.json --env production" } } }
Wint
source share