【问题标题】:"npm start" on multiple directories多个目录上的“npm start”
【发布时间】:2018-03-16 11:57:42
【问题描述】:

我有一个项目需要在不同的文件夹和数据库服务器上运行多个服务。

如何在自己的终端中自动运行所有这些? 进入每个文件夹并在单独的终端窗口上运行“npm start”。

谢谢。

【问题讨论】:

    标签: python node.js terminal


    【解决方案1】:

    你可以这样跑

    npm start & mongod & node public/app.js &
    

    & 使进程在后台运行,因此一旦会话关闭,服务器就会停止 但是你可以使用 nohup 来保持它的运行

    【讨论】:

      【解决方案2】:

      你可以用这个:

      https://www.npmjs.com/package/concurrently

      同时“command1 arg”“command2 arg”

      【讨论】:

        【解决方案3】:

        开发中:

        看看tmuxscreen。它们提供了一种运行多个 shell 的简单方法。您甚至可以自动启动 (How to write a shell script that starts tmux session, and then runs a ruby script),并且有一些工具可以轻松配置它,例如。 https://github.com/remiprev/teamocil

        生产中:

        您可能不希望在分离的终端中运行生产应用程序/服务。通过适当的日志记录等,有更合适的工具。我在以下方面有很好的经验:

        • forever,用于运行 Node 应用程序
        • supervisord,为了跑步……任何事情,真的

        【讨论】:

          猜你喜欢
          • 2021-08-17
          • 2018-12-23
          • 1970-01-01
          • 2016-07-10
          • 2018-03-28
          • 2022-09-26
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多