gpt4 book ai didi

javascript - 在服务器上通过pm2或类似的东西运行 Nightmare

转载 作者:行者123 更新时间:2023-11-30 15:45:07 24 4
gpt4 key购买 nike

如何在服务器上通过pm2或类似的东西运行nightmarejs,因为 Nightmare 使用电子,而电子现在需要图形,我正在使用xvfb-run npm start ,但是这个 sol° 需要我通过 ssh 与服务器保持连接,你有什么建议吗?

最佳答案

有点老了,但在这里我的答案可能会对某人有所帮助。

  1. 使用下一个命令为 pm2 (process.json) 创建一个执行文件。替换您的具体情况。
{
"apps" : [{
"name" : "<your_app_name>",
"script" : "<your_main.js>",
"env": {
"DISPLAY": ":99"
}
},
{
"name" : "Xvfb",
"interpreter" : "none",
"script" : "Xvfb",
"args" : ":99"
}]
}
  • 将此文件移动到您的 dist 文件夹或存储主文件的位置。
  • 执行pm2 start process.json
  • 您应该看到两个项目都在执行。

    更多信息您可以关注this

    关于javascript - 在服务器上通过pm2或类似的东西运行 Nightmare ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40178836/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com