2

PM2:v.4.4.0

NodeJS :v.10.16.0。

配置.json:

{
    "name": "app-name",
    "script": "server",
    "exec_mode": "fork",
    "instances": 0,    
    "wait_ready": true
    "listen_timeout": 10000,
    "kill_timeout": 5000,
    <config params>....
}

我尝试在 Windows 2012 Server 和 Ubuntu 18 中启动应用程序。

如果我从fork开始一切正常。

│ 28  │ front-qa        │ default     │ N/A     │ fork    │ 10216    │ 22m    │ 0    │ online    │ 0%       │ 232.4mb  │
 mku: │ disabled │
└─────┴─────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴

但是,如果我尝试以集群模式启动 pm2 start app config.json - 不起作用。

配置.json:

{
    "name": "app-name",
    "script": "server",
    "exec_mode": "cluster",
    "instances": 0,    
    "wait_ready": true
    "listen_timeout": 10000,
    "kill_timeout": 5000,
    <config params>....
}

在窗口中:

C:\PROGRAM FILES\NODEJS\NODE.EXE:1
MZ�
  ^

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at C:\Tools\npm\node_modules\pm2\lib\ProcessContainer.js:303:25
    at wrapper (C:\Tools\npm\node_modules\pm2\node_modules\async\internal\once.js:12:16)
    at next (C:\Tools\npm\node_modules\pm2\node_modules\async\waterfall.js:96:20)
    at C:\Tools\npm\node_modules\pm2\node_modules\async\internal\onlyOnce.js:12:16
    at WriteStream.<anonymous> (C:\Tools\npm\node_modules\pm2\lib\Utility.js:186:13)

在带有 NVM 的 Ubuntu 18 中:

/opt/nvm/nvm/versions/node/v10.16.0/bin/node:1
.ELF....
^

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at /opt/nvm/nvm/versions/node/v10.16.0/lib/node_modules/pm2/lib/ProcessContainer.js:303:25
    at wrapper (/opt/nvm/nvm/versions/node/v10.16.0/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
    at next (/opt/nvm/nvm/versions/node/v10.16.0/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
    at /opt/nvm/nvm/versions/node/v10.16.0/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
    at WriteStream.<anonymous> (/opt/nvm/nvm/versions/node/v10.16.0/lib/node_modules/pm2/lib/Utility.js:186:13)

任何身体帮助?

4

0 回答 0