首页 > 解决方案 > 尝试纱线启动时出现奇怪的 IP - EADDRNOTAVAIL

问题描述

我在笔记本电脑上安装了相当全新的 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 操作系统还是很陌生。

标签: node.jsreactjsyarnpkgopensuse

解决方案


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


推荐阅读