-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use npm "start" script when running PM2 "start" command (if available) #1317
Comments
You can use an ecosystem.json file and then call |
I did notice that but it seemed like having the ability to do it from the standard npm start script would be nice as well. It doesn't seem like it would be all that big of a change, but I would understand concerns about feature creep. Still, if I implemented this along with necessary tests and documentation is it possible the changes would be merged? Thanks. |
I think the solution proposed here is: {
"name": "my_app",
"scripts": {
"start": "pm2 startOrReload ecosystem.json"
}
} It will allow you to use pm2 by just running |
I wish I could start pm2 from ecosystem.json Npm modules in a way like @eTorAken said:
instead of:
😭 |
I'm looking for the same as @andrewrothman Anyway to do this without using ecosystem? Seems highly unnecessary to have another json file to configure. |
+1 |
1 similar comment
+1 |
Please, try |
@pibi It did work on my mac. But it did not work on Ubuntu... |
+1 |
@yizhiheng Try to substitute |
+1. The
I know it's a little bit off topic but I wanna share my workaround for running scripts through "deploy": {
"production": {
"user": "worker",
"host": "X.X.X.X",
"ref": "origin/master",
"repo": "git@mydomain:user/repo.git",
"path": "/home/worker/app",
"post-deploy": "npm install && pm2 restart {app name}"
}
} I make sure that I can ssh to the server using the user mentioned above, then I execute
Now I can deploy my app with the |
👍 @xpepermint that was very helpful -- I was finding that I was not using npm when starting apps with pm2 and it felt unclean. Now I am cleansed 😜 |
Starting the command $ pm2 start npm -- start Please refer to #2176 |
NPM allows a start script to be defined inside of the package.json like so...
Which is then executed by running "npm start".
This issue would have the "pm2 start" command use the script defined in the "package.json" file under "start" instead of requiring it to be passed via a command line argument.
The text was updated successfully, but these errors were encountered: