pm2将ecosystem.config.js生产设置部署到运行Windows Server 2019的ec2实例失败

时间:2019-09-24 09:30:47

标签: windows git-bash pm2 windows-server-2019

我正在将一个项目部署到一个运行ubuntu的ec2实例,并且一切都在使用以下ecosystem.config.js进行:

module.exports = {
  apps: [
    {
      name: "lolapi",
      script: "yarn",
      args: "start"
    }
  ],
  deploy: {
    production: {
      user: "ubuntu",
      host: "ec2-18-185-80-58.eu-central-1.compute.amazonaws.com",
      key: "C:/Users/Moka/.ssh/lol-app.pem",
      ref: "origin/master",
      repo: "https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/lolapi",
      path: "/home/ubuntu/lolapi",
      "post-deploy": "yarn install && pm2 startOrRestart ecosystem.config.js --env production"
    }
  }
};

当我尝试使用运行Windows Server 2019的ec2而不是运行pm2 deploy ecosystem.config.js production setup的ubuntu时失败,并显示以下输出

--> Deploying to production environment
--> on host ec2-18-197-176-168.eu-central-1.compute.amazonaws.com
  ○ hook pre-setup
Administrator@ec2-18-197-176-168.eu-central-1.compute.amazonaws.com's password:
The syntax of the command is incorrect.

  setup paths failed

Deploy failed
1

我使用了以下ecosystem.config.js

module.exports = {
  apps: [
    {
      name: "lolapi",
      script: "yarn",
      args: "start"
    }
  ],
  deploy: {
    production: {
      user: "Administrator",
      host: "ec2-18-197-176-168.eu-central-1.compute.amazonaws.com",
      key: "C:/Users/Moka/.ssh/lol-app.pem",
      ref: "origin/master",
      repo: "https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/lolapi",
      path: "C:/Users/Administrator/Desktop/lolapi",
      "post-deploy":
        "yarn install && pm2 startOrRestart ecosystem.config.js --env production"
    }
  }
};
我的笔记本电脑的

pm2报告

$ pm2 report
===============================================================================
--- PM2 REPORT (Mon Sep 23 2019 19:23:52 GMT+0200 (Eastern European Standard Time))
===============================================================================
--- Daemon --------------------------------------------------------------------
pm2d version         : 3.2.4
node version         : 10.14.1
node path            : D:/ahmed/coding/nodejs/node
argv                 : D:\ahmed\coding\nodejs\node.exe,C:\Users\Moka\AppData\Local\Yarn\Data\global\node_modules\pm2\lib\Daemon.js
argv0                : node
user                 : undefined
uid                  : N/A
gid                  : N/A
uptime               : 228min
===============================================================================
--- CLI -----------------------------------------------------------------------
local pm2            : 3.2.4
node version         : 10.14.1
node path            : D:/ahmed/coding/nodejs/node
argv                 : D:\ahmed\coding\nodejs\node.exe,C:\Users\Moka\AppData\Local\Yarn\Data\global\node_modules\pm2\bin\pm2,report
argv0                : D:\ahmed\coding\nodejs\node.exe
user                 : Double Click
===============================================================================
--- System info ---------------------------------------------------------------
arch                 : x64
platform             : win32
type                 : Windows_NT
cpus                 : Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
cpus nb              : 4
freemem              : 1657335808
totalmem             : 8471814144
home                 : C:\Users\Moka
===============================================================================
--- PM2 list ------------------------------------------------------------------
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
===============================================================================
--- Daemon logs ---------------------------------------------------------------
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

运行Windows Server 2019的ec2实例的pm2报告

===============================================================================
--- PM2 REPORT (Sun Sep 29 2019 07:17:32 GMT+0000 (Greenwich Mean Time)) ------
===============================================================================
--- Daemon --------------------------------------------------------------------
pm2d version         : 3.2.4
node version         : 10.14.1
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2-windows-service\src\service.js
argv0                : C:\Program Files\nodejs\node.exe
user                 : undefined
uid                  : N/A
gid                  : N/A
uptime               : 6373min
===============================================================================
--- CLI -----------------------------------------------------------------------
local pm2            : 3.2.4
node version         : 10.14.1
node path            : C:/Program Files/nodejs/node
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0                : C:\Program Files\nodejs\node.exe
user                 : Administrator
===============================================================================
--- System info ---------------------------------------------------------------
arch                 : x64
platform             : win32
type                 : Windows_NT
cpus                 : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
cpus nb              : 1
freemem              : 189435904
totalmem             : 1073332224
home                 : C:\Users\Administrator
===============================================================================
--- PM2 list ------------------------------------------------------------------
┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬───────────────┬──────────┐
│ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem       │ user          │ watching │
├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼───────────────┼──────────┤
│ index    │ 0  │ 1.0.0   │ fork │ 2796 │ online │ 0       │ 4D     │ 0%  │ 33.3 MB   │ Administrator │ disabled │
└──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴───────────────┴──────────┘
===============================================================================
--- Daemon logs ---------------------------------------------------------------
c:\etc\.pm2\pm2.log last 20 lines:
PM2        | 2019-09-24T21:01:45: PM2 log: App [index:0] exited with code [1] via signal [SIGINT]
PM2        | 2019-09-24T21:01:45: PM2 log: pid=3236 msg=process killed
PM2        | 2019-09-24T21:01:46: PM2 log: PM2 successfully stopped
PM2        | 2019-09-24T21:01:54: PM2 log: ===============================================================================
PM2        | 2019-09-24T21:01:54: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2019-09-24T21:01:54: PM2 log: Time                 : Tue Sep 24 2019 21:01:54 GMT+0000 (Greenwich Mean Time)
PM2        | 2019-09-24T21:01:54: PM2 log: PM2 version          : 3.2.4
PM2        | 2019-09-24T21:01:54: PM2 log: Node.js version      : 10.14.1
PM2        | 2019-09-24T21:01:54: PM2 log: Current arch         : x64
PM2        | 2019-09-24T21:01:54: PM2 log: PM2 home             : c:/etc/.pm2/
PM2        | 2019-09-24T21:01:54: PM2 log: PM2 PID file         : c:\etc\.pm2\pm2.pid
PM2        | 2019-09-24T21:01:54: PM2 log: RPC socket file      : \\.\pipe\rpc.sock
PM2        | 2019-09-24T21:01:54: PM2 log: BUS socket file      : \\.\pipe\pub.sock
PM2        | 2019-09-24T21:01:54: PM2 log: Application log path : c:\etc\.pm2\logs
PM2        | 2019-09-24T21:01:54: PM2 log: Process dump file    : c:\etc\.pm2\dump.pm2
PM2        | 2019-09-24T21:01:54: PM2 log: Concurrent actions   : 2
PM2        | 2019-09-24T21:01:54: PM2 log: SIGTERM timeout      : 1600
PM2        | 2019-09-24T21:01:54: PM2 log: ===============================================================================
PM2        | 2019-09-24T21:02:19: PM2 log: App [index:0] starting in -fork mode-
PM2        | 2019-09-24T21:02:19: PM2 log: App [index:0] online

0 个答案:

没有答案