windows pm2 啓動nodejs失敗:Error: EBADF: bad file descriptor, uv_pipe_open

windows下打開命令窗口,安裝pm2:npm install pm2 -g
pm2成功安裝,在項目目錄下用pm2啓動服務:pm2 start index.js,結果啓動失敗,錯誤以下:

.pm2\pm2.log last 15 lines:
PM2 | 2018-11-13T12:57:17: PM2 log: App [index:0] exited with code [1] via signal [SIGINT]
\index.js had too many unstable restarts (16). Stopped. "errored"node

 
Error: EBADF: bad file descriptor, uv_pipe_open
at Object.exports._forkChild (child_process.js:110:5)
at Object.setupChannel (internal/process.js:247:8)
at startup (bootstrap_node.js:63:16)
at bootstrap_node.js:608:3
child_process.js:110
p.open(fd);
^
Error: EBADF: bad file descriptor, uv_pipe_open
at Object.exports._forkChild (child_process.js:110:5)
at Object.setupChannel (internal/process.js:247:8)
at startup (bootstrap_node.js:63:16)
at bootstrap_node.js:608:3
 
 
解決方案:
windows下用pm2啓動node的時候,用cluster_mode啓動,就能夠成功啓動node服務了。
命令以下:pm2 start index.js -i 0 -f    以cluster模式啓動 node服務
相關文章
相關標籤/搜索