【问题标题】:Strange IP when trying to yarn start - EADDRNOTAVAIL尝试纱线启动时出现奇怪的 IP - EADDRNOTAVAIL
【发布时间】:2019-05-09 06:53:22
【问题描述】:

我的笔记本电脑上安装了相当全新的 OpenSUSE,并试图测试一个全新的 React 应用程序。

我从 create-react-app 站点运行了以下命令:

    npx create-react-app my-app
    cd my-app
    yarn start

发生这种情况时,我会在终端中得到以下输出

yarn run v1.15.2
$ react-scripts start
Attempting to bind to HOST environment variable: linux-wjcv
If this was unintentional, check that you haven't mistakenly set it in your shell

Could not find an open port at linux-wjcv
Network error message:  listen EADDRNOTAVAIL 92.242.140.2

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我确认 linux-wjcv 是我的计算机名,但我不确定 92.242.140.2 IP 地址来自哪里。快速谷歌搜索告诉我,IP 位于爱尔兰,离我很远。

我快速查看了 /etc/hosts 中的 hosts 文件,我看到的所有内容都经过 127.0.0.1。所以我不确定这个 IP 来自哪里,或者为什么新的应用程序会尝试使用它。

127.0.0.1   localhost

# special IPv6 addresses
::1         localhost ipv6-localhost ipv6-loopback

fe00::0     ipv6-localnet

ff00::0     ipv6-mcastprefix
ff02::1     ipv6-allnodes
ff02::2     ipv6-allrouters
ff02::3     ipv6-allhosts

如果这是一个愚蠢的问题,我深表歉意。我对运行 Unix 操作系统还是很陌生。

【问题讨论】:

  • 如果我使用“HOST=127.0.0.1 yarn start”,它会在我的本地服务器上正确运行

标签: node.js reactjs yarnpkg opensuse


【解决方案1】:

您的主机名“linux-wjcv”未在主机文件中定义,因此系统尝试通过 DNS 查找其 IP 地址。尝试像这样定义它: 127.0.0.1 localhost linux-wjcv

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-09
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多