现在的位置: 首页 > 综合 > 正文

node pm2 启动 Error: getaddrinfo ENOTFOUND 解决方法

2017年11月10日 ⁄ 综合 ⁄ 共 386字 ⁄ 字号 评论关闭

在新的服务器上部署node以后,使用pm2 作为进程管理工具,

安装完成以后,pm2 无论执行 

pm2 list 还是pm2 的其它命令,全部报

 Error: getaddrinfo ENOTFOUND

的错误。

仔细检查安装都没问题,上git pm2的issue搜索发现,居然是hosts的原因导致的。

默认centos的 hosts 会把本地 127.0.0.1 localhost 注释掉,去掉再试下就可以了。

参见git pm2 issue:


原解答:
My fault! My deployment scripts
were accidentally deleting the 
localhost from
the 
/etc/hosts file,
making it impossible to nodejs find the local machine.

抱歉!评论已关闭.