Error: ENOENT: no such file or directory, uv_cwd


64x64
锤道仁 2017-11-13 23:29 626

在更新完项目后,用PM2启用项目的时候,突然报错:

[root@GZH-TMA-S0-RECOMMEND-WEB-185 node]# pm2 logs
[PM2] Tailing last 20 lines for [all] processes 

PM2: 2017-11-13 09:54:52: Script /data/node/node-server/msr/start.js had too many unstable restarts (16). Stopped. "errored"
PM2: 2017-11-13 09:54:52: App name:nrecommend-manage id:1 online
PM2: path.js:1142
PM2:           cwd = process.cwd();
PM2:                         ^
PM2: 
PM2: Error: ENOENT: no such file or directory, uv_cwd
PM2:     at Error (native)
PM2:     at Object.resolve (path.js:1142:25)
PM2:     at Function.Module._resolveLookupPaths (module.js:390:17)
PM2:     at Function.Module._resolveFilename (module.js:460:31)
PM2:     at Function.Module._load (module.js:417:25)
PM2:     at Module.require (module.js:497:17)
PM2:     at require (internal/module.js:20:19)
PM2:     at Object.<anonymous> (/data/node/node/lib/node_modules/pm2/lib/ProcessContainer.js:12:15)
PM2:     at Module._compile (module.js:570:32)
PM2:     at Object.Module._extensions..js (module.js:579:10)
PM2: 2017-11-13 09:54:52: App name:nrecommend-manage id:1 disconnected
PM2: 2017-11-13 09:54:52: App [nrecommend-manage] with id [1] and pid [31411], exited with code [1] via signal [SIGINT]
PM2: 2017-11-13 09:54:52: Script /data/node/node-server/msr/start.js had too many unstable restarts (16). Stopped. "errored"

nrecommend-manage-0 (err): Error: read ECONNRESET
nrecommend-manage-0 (err):     at exports._errnoException (util.js:1018:11)
nrecommend-manage-0 (err):     at TLSWrap.onread (net.js:568:26)
nrecommend-manage-0 (err): Error: read ECONNRESET
nrecommend-manage-0 (err):     at exports._errnoException (util.js:1018:11)
nrecommend-manage-0 (err):     at TLSWrap.onread (net.js:568:26)
nrecommend-manage-0 (err): Error: read ECONNRESET
nrecommend-manage-0 (err):     at exports._errnoException (util.js:1018:11)
nrecommend-manage-0 (err):     at TLSWrap.onread (net.js:568:26)
nrecommend-manage-0 (err): Error: getaddrinfo EAI_AGAIN 6nfgze.ceye.io|ifconfig:443
nrecommend-manage-0 (err):     at Object.exports._errnoException (util.js:1018:11)
nrecommend-manage-0 (err):     at errnoException (dns.js:33:15)
nrecommend-manage-0 (err):     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
nrecommend-manage-0 (err): Error: getaddrinfo EAI_AGAIN 6nfgze.ceye.io && wget http:443
nrecommend-manage-0 (err):     at Object.exports._errnoException (util.js:1018:11)
nrecommend-manage-0 (err):     at errnoException (dns.js:33:15)
nrecommend-manage-0 (err):     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
nrecommend-manage-0 (err): Error: read ECONNRESET
nrecommend-manage-0 (err):     at exports._errnoException (util.js:1018:11)
nrecommend-manage-0 (err):     at TLSWrap.onread (net.js:568:26)

nrecommend-manage-1 (err): Error: getaddrinfo ENOTFOUND http http:443
nrecommend-manage-1 (err):     at errnoException (dns.js:28:10)
nrecommend-manage-1 (err):     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
nrecommend-manage-1 (err): Error: read ECONNRESET
nrecommend-manage-1 (err):     at exports._errnoException (util.js:1018:11)
nrecommend-manage-1 (err):     at TLSWrap.onread (net.js:568:26)
nrecommend-manage-1 (err): Error: read ECONNRESET
nrecommend-manage-1 (err):     at exports._errnoException (util.js:1018:11)
nrecommend-manage-1 (err):     at TLSWrap.onread (net.js:568:26)
nrecommend-manage-1 (err): Error: getaddrinfo EAI_AGAIN 6nfgze.ceye.io|ifconfig:443
nrecommend-manage-1 (err):     at Object.exports._errnoException (util.js:1018:11)
nrecommend-manage-1 (err):     at errnoException (dns.js:33:15)
nrecommend-manage-1 (err):     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
nrecommend-manage-1 (err): Error: getaddrinfo EAI_AGAIN 6nfgze.ceye.io && wget http:443
nrecommend-manage-1 (err):     at Object.exports._errnoException (util.js:1018:11)


nodepm2mvc 回答问题

2 个解决方案


1
睡懒觉的猫 2017-11-13T23:36:53

1.先获取PM2的进程ID,ps ax | grep PM2 

23498        Ss1    0:30    PM2    xxxx God Daemon

2.确认一下进程所指向的路径是否正确,ls -l /proc/PM2_PID/cwd

xxxx    1    root    root 0 xxxx     /xxx/xxx/xxx/cwd -> /xxx/xxx/blog(deleted)

我这里的路径和我的项目不一致,所以启动报错了

3.如果不正确,重启一下:pm2 kill

4 查看输出下log ,确定是否重启成功。


2
123456 2017-10-27T15:19:29
使用try,catch 捕捉异常,当出现异常就返回空,如:
try{
    return jdbcTemplate.queryForMap(sql, params);
}catch(EmptyResultDataAccessException ede){
    return null;
}

评论