node.js - 尝试纱线启动时出现奇怪的 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 操作系统还是很陌生。
解决方案
您的主机名“linux-wjcv”未在主机文件中定义,因此系统尝试通过 DNS 查找其 IP 地址。尝试像这样定义它:
127.0.0.1 localhost linux-wjcv
推荐阅读
- python - 为什么这个函数两次改变列表?
- python - 如何根据 y 值向条形图添加颜色渐变?
- html - HTTP 中包含的网页的实际 HTML 标记在哪里?
- arrays - ObjectAtIndex 索引 0 超出分段控件中空数组的范围
- ios - Swift - 删除硬编码字符串的最佳方法是什么?
- flutter - 如何为在颤动中打开 pdf、doc.pptx 文件提供多个选项?
- c# - 从 C# 中的 DLL 访问类/方法
- java - 使用 Kafka 在两个微服务之间同步数据
- c# - 如何使用字符串和 int(字符串)值创建枚举
- java - 像 Telegram 一样长按后如何突出显示 recyclerView 的项目?