3月 232020
 

PM2中重启服务时,出现下面提示:

PM2: path.js:422
PM2: var path = (i >= 0) ? arguments[i] : process.cwd();
PM2: ^
PM2:
PM2: Error: ENOENT: no such file or directory, uv_cwd
PM2: at Error (native)
PM2: at Object.posix.resolve (path.js:422:50)
PM2: at Function.Module._resolveLookupPaths (module.js:248:17)
PM2: at Function.Module._resolveFilename (module.js:326:31)
PM2: at Function.Module._load (module.js:286:25)
PM2: at Module.require (module.js:365:17)
PM2: at require (module.js:384:17)
PM2: at Object.<anonymous> (/usr/local/bin/node_modules/pm2/lib/ProcessContainer.js:12:15)
PM2: at Module._compile (module.js:434:26)
PM2: at Object.Module._extensions..js (module.js:452:10)

 

出现这种情况原因很可能是你不经意间修改了当时启动服务时的目录,比如修改了目录名,移动了目录等, 可以通过下面的方法核实下:

原因:

  1. 通过pm2 list  中找到不能重启的服务的进程号pid
  2. 通过  ls -l /proc/pid(上面1找到的pid)/cwd, 检查下这个目录是不是被删除了?

 

最终解决方案:

  1. ps ax | grep PM2
  2. 找到pm2进程
  3.  kill pid(进程号)
  4.  pm2 list(或是其他的pm2 命令对pm2 进行重启)

 

 

 

 

 

Sorry, the comment form is closed at this time.