NPM在SSH连接之后的服务器上开始(EC2)
我有一个从“ NPM启动”开始的应用程序 我想在后台运行它。 该应用程序托管在AWS EC2上。
我尝试了:
npm start& 如果我断开SSH连接,则不起作用
nohup npm start& 同样,如果我断开SSH连接
,它会失败- 同样,如果我尝试使用root或用户启动的 。
我也永远尝试了
非常感谢您的帮助
I have an app that I start with "npm start"
I would like to run it in background.
This app is hosted on aws EC2.
I tried :
npm start &
Doesnt work if I disconnect ssh connectionnohup npm start &
Same, it fail if I disconnect ssh connectionI tried to launch with root, or user, doesnt make any difference.
I also tried forever but I didnt manage to launch with npm start like "forever start npm start" doesnt work
Thanks a lot for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您必须使用Docker。
您需要阅读很多文档,因为了解您是否不知道这很复杂: https:https: //docs.docker.com/get- started/ ,
但它确实可以做您想要的,在容器中运行应用程序。
您可以关闭您的应用程序仍将运行的所有内容。
喜欢阅读!
You have to use docker.
You will need to read a lot the documentation, because it's complicated to understand if you dont know it : https://docs.docker.com/get-started/
But it does exactly what you want, running app in background in a container.
You can close everything your app will still run.
Enjoy reading !
下次我会尝试Docker风格,因为我的时间没时间了。
我找到了使用:“屏幕”命令的方法
!
I will try the docker style next time because im running out of time.
I found a way using :
"screen" command !
实际上该过程在屏幕上几个小时后停止
Actually the process stop after few hours with screen
您可以将新命令(nohup)添加到您的软件包。JSON:
它应该复制您的start命令,但请使用nohup和&
You can add a new command (nohup) to your package.json:
It should copy your start command, but surround it with nohup and &