Node.js / webpack / getaddrinfo在不需要时寻找互联网,为什么?

问题描述 投票:0回答:3

我有一个应该可以离线运行的机器的问题。

我的应用程序运行后可以拉电缆,但在拔出插头时我收到以下错误:

May  6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
May  6 23:04:50 myco serve[4121]:     at Object._errnoException (util.js:1022:11)
May  6 23:04:50 myco serve[4121]:     at errnoException (dns.js:55:15)
May  6 23:04:50 myco serve[4121]:     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
May  6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
May  6 23:04:50 myco serve[4121]: (node:4121) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

似乎dns.js是webpack / node-libs-browser的一部分,但据我所知,我无法在源代码树中的任何地方找到GetAddrInfoReqWrap,或者getaddrinfo就此而言。在故意尝试使用npm时,搜索周围的人会收到类似错误的信息很多,但这不是我正在做的事情。我应该已经在机器上拥有我需要的一切。

npm webpack getaddrinfo
3个回答
0
投票

显然这是服务的问题。

服务> 6.5.3显然有一个问题,它试图联系注册表。将服务降级到6.5.3解决了这个特殊问题。

这在https://github.com/zeit/serve/issues/348中有记录

不确定为什么服务需要联系注册表。


0
投票

noafterglow是对的,但仅供参考,回滚到版本6.5.3的服务可以完成

npm install -g [email protected]

资料来源:this post


0
投票

当我尝试从最初开发代码的不同VM提供VueJs应用程序时,我遇到了这个错误。

文件vue.config.js读取:

 module.exports = {
   devServer: {
     host: 'tstvm01',
     port: 3030,
   },
 };

在原始机器上提供时,启动输出为:

App running at:
- Local:   http://tstvm01:3030/ 
- Network: http://tstvm01:3030/

在VM上使用相同的设置tstvm07给我一个非常类似于OP描述的错误:

 INFO  Starting development server...
 10% building modules 1/1 modules 0 activeevents.js:183                              
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo EAI_AGAIN
    at Object._errnoException (util.js:1022:11)
    at errnoException (dns.js:55:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

如果还不是很明显,请将vue.config.js更改为阅读...

 module.exports = {
   devServer: {
     host: 'tstvm07',
     port: 3030,
   },
 };

......解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.