pm2 启动程序报错

来源:14-1 开始和 PM2 介绍

LC1243208

2019-05-01

pm2-test项目
运行 npm run prd报错

“prd”:“cross-env NODE_ENV=production pm2 start app.js”

报错内容:

> 07.pm2-test@1.0.0 prd e:\03-MY\Node\NodeDemo\07.pm2-test
> cross-env NODE_ENV=production pm2 start app.js
connect EPERM //./pipe/rpc.sock
[PM2] Spawning PM2 daemon with pm2_home=C:\Users\elva\.pm2
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: connect EPERM //./pipe/rpc.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
Emitted 'error' event at:
    at Socket.<anonymous> (C:\Users\elva\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\sock.js:201:49)
    at Socket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 07.pm2-test@1.0.0 prd: `cross-env NODE_ENV=production pm2 start app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 07.pm2-test@1.0.0 prd script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\elva\AppData\Roaming\npm-cache\_logs\2019-05-01T12_33_00_214Z-debug.log
写回答

2回答

双越

2019-05-01

没遇到过类似的问题。我帮你查了一下,很有可能是权限的原因。

看你是 windows 用户,你用管理员身份打开控制台,然后再尝试运行试试。

0
1
LC1243208
嗯,我找到原因了,需要重启才生效!
2019-05-01
共1条回复

LC1243208

提问者

2019-05-01

npm run dev

node app.js 均没问题,可正常运行

pm2 3.5.0版本

0
0

Node.js+Express+Koa2+Nest.js 开发服务端

从入门到实战,一站式掌握 Node.js+Express+Koa2

4051 学习 · 2006 问题

查看课程