建立反应应用程式错误 [英] Create-react-app error
问题描述
我想使用create-react-app,所以请按照以下说明操作:
I would like to use create-react-app, so I follow the instruction:
npm install -g create-react-app
create-react-app my-app
cd my-app/
npm start
但是我在最后一步有错误。运行 npm start
后,出现错误:
But I have error on last step. After running npm start
I get error:
在以下位置找不到打开的端口linux-llw5。网络错误消息:
getaddrinfo ENOTFOUND linux-llw5
Could not find an open port at linux-llw5. Network error message: getaddrinfo ENOTFOUND linux-llw5
我该如何解决?
推荐答案
您的计算机可能具有全局 HOST
环境变量,因此Create React App尝试在其上找到开放端口而不是默认的 localhost
。删除环境变量,它应该可以正常运行。
Your machine probably has a global HOST
environment variable so Create React App tries to find an open port on it instead of the default localhost
. Delete the environment variable and it should work fine as you want.
或者,您可以在<$中显式更改 start
package.json
中的c $ c> scripts 来运行 HOST = localhost react-scripts start
。但这似乎有点复杂。
Alternatively you can explicitly change start
in scripts
in package.json
to run HOST=localhost react-scripts start
. But this seems a bit complex.
这篇关于建立反应应用程式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!