请检查您的网络连接。这解决了我的问题,因为ENETUNREACH是网络问题,如主机不可达或您的网关不工作。
localhost
属性更改为127.0.0.1
,如下所示:var connection = mysql.createConnection({
// host : 'localhost', // localhost causes somehow this error
host: '127.0.0.1',
我之前遇到类似的错误,后来我在我的电脑上禁用了IPv6,然后这个错误就不再出现了。
我遇到了同样的问题。我的问题是我在 npm
配置中仍然有公司代理设置。我的解决方法:
npm config list
npm config delete https-proxy
你可能有更多的代码,但是在那之后,错误就消失了。
raspi-config
并设置boot options … wait for network at boot … yes
来完成的(我在其中运行脚本)。 - Paulo S. Abreu