我试图弄清楚为什么由于错误而导致“ yarn start”命令无法完成(据我所知,带有端口的东西)

时间:2019-08-27 23:42:52

标签: node.js port node-modules yarnpkg npm-start

我正在尝试通过使用以下两个基本脚本来启动我的项目:

"start": "webpack-dev-server --env.mode development --env.port 8080",
"build": "webpack --env.mode production".

不幸的是,我继续遇到下一个错误:

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND localhost
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
Emitted 'error' event at:
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1457:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:17)
error Command failed with exit code 1.

build脚本执行没有任何错误,但是启动一个脚本根本不会运行。我已经尝试过切换端口,卸载节点并重新安装(将LTS的版本切换为最新版本,然后再重新安装),我尝试使用netstat杀死8080后运行的所有进程,没有任何帮助。

如果有帮助,则下一条执行停止的events.js行:

  events = target._events;
  if (events === undefined) {
    events = target._events = Object.create(null);
    target._eventsCount = 0;
  }// else {
    // To avoid recursion in the case that type === "newListener"! Before
    // adding it to the listeners, first emit "newListener".
   (LINE 173) if (events.newListener !== undefined) {
      target.emit('newListener', type,
                  listener.listener ? listener.listener : listener);

      // Re-assign `events` because a newListener handler could have caused the
      // this._events to be assigned to a new object
      events = target._events;
    }
    existing = events[type];
  }

0 个答案:

没有答案