在Windows中以群集模式启动pm2时出错

时间:2015-06-18 06:34:54

标签: node.js cluster-computing pm2

我在集群模式下启动pm2时遇到错误。 我跑了这个命令 -

pm2 start <filename> -i 4

只创建一个实例。 我使用的是Windows 7,Node 0.12.0和pm2 0.14.0

这是我的错误日志

  

2015-06-18 10:52:04:[PM2] [WORKER]以刷新间隔开始:   30000 2015-06-18 10:52:04:[[[[PM2 / God daemon launch]]]]   2015-06-18 10:52:04:端口\。\ pipe \ pub.sock上的BUS系统[READY]   2015-06-18 10:52:04:端口\。\ pipe \ rpc.sock上的RPC接口[READY]   2015-06-18 10:52:04:在集群模式下启动执行顺序   app name:server id:0 2015-06-18 10:52:04:App name:server id:0 online   2015-06-18 10:52:04:在集群模式下启动执行顺序   app name:server id:1 2015-06-18 10:52:04:Trace:{[错误:spawn   EBADF]代码:&#39; EBADF&#39;,错误:&#39; EBADF&#39;,系统调用:&#39; spawn&#39; }       at Object.God.logAndGenerateError(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ Methods.js:30:15)       at Object.nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ ClusterMode.js:52:11)       在Object.executeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:145:9)       在ex(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:361:18)       在C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:365:16       在Worker.cluOnline(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:188:17)       在Worker.g(events.js:199:16)       在Worker.emit(events.js:104:17)       在线(cluster.js:449:12)       在Worker.onmessage(cluster.js:436:7)2015-06-18 10:52:04:以集群模式启动执行顺序 - 对于应用程序名称:服务器ID:2   2015-06-18 10:52:05:跟踪:{[错误:产生EBADF]代码:&#39; EBADF&#39;,   错误:&#39; EBADF&#39;,系统调用:&#39; spawn&#39; }       at Object.God.logAndGenerateError(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ Methods.js:30:15)       at Object.nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ ClusterMode.js:52:11)       在Object.executeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:145:9)       在ex(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:361:18)       在C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:362:25       在nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:146:29)       at Object.nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ ClusterMode.js:53:14)       在Object.executeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:145:9)       在ex(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:361:18)       在C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:365:16   2015-06-18 10:52:05:在集群模式下启动执行顺序   app name:server id:3 2015-06-18 10:52:05:Trace:{[错误:产生   EBADF]代码:&#39; EBADF&#39;,错误:&#39; EBADF&#39;,系统调用:&#39; spawn&#39; }       at Object.God.logAndGenerateError(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ Methods.js:30:15)       at Object.nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ ClusterMode.js:52:11)       在Object.executeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:145:9)       在ex(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:361:18)       在C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:362:25       在nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:146:29)       at Object.nodeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God \ ClusterMode.js:53:14)       在Object.executeApp(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:145:9)       在ex(C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:361:18)       在C:\ Users \ pbaid \ AppData \ Roaming \ npm \ node_modules \ pm2 \ lib \ God.js:362:25

2 个答案:

答案 0 :(得分:0)

我今天也遇到了这个问题。

如果我跑&#34; pm2 log&#34;在任何其他pm2操作之前,然后以集群模式启动应用程序(&#34; pm2 start app.js -i 4&#34;),一切看起来都很好。似乎pm2需要一些时间进行初始化。我不知道真正的原因。

期待更好的解决方案。

答案 1 :(得分:-2)

在Windows上,不要使用群集:

pm2 start "filename.js"