docusaurus 启动出错 - Error: getaddrinfo ENOTFOUND localhost
2021/12/25 6:07:09
本文主要是介绍docusaurus 启动出错 - Error: getaddrinfo ENOTFOUND localhost,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
解决方法
检查hosts
文件, 应该是localhost
没了
添加
127.0.0.1 localhost
起因
想要翻译文档, 打算使用 docusaurus
根据文档执行
npx create-docusaurus@latest my-website classic
后创建项目成功, 安装依赖一切正常
当我执行 start 时遇到错误
yarn run v1.22.17 $ docusaurus start [INFO] Starting the development server... [SUCCESS] Docusaurus website is running at http://localhost:3000/. ● Client █████████████████████████ setup (3%) watch run (node:40311) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. (Use `node --trace-deprecation ...` to show where the warning was created) /Users/sftc/Desktop/my-website/node_modules/webpack-dev-server/lib/Server.js:2440 throw error; ^ Error: getaddrinfo ENOTFOUND localhost at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'localhost' } error Command failed with exit code 1.
我们应该会下意识看到第一句Warning
把它当成报错, 实际上这个不会影响运行
饶了好大一圈, 看到了这个回答 Cant load a react app after starting server
It's just a deprecation warning from one of the libraries you used within the app, have you tried to open http://localhost:3000 on your local? it is supposed to be running fine
我当然是看项目没跑起来才搜索报错原因的啊
我开始怀疑node版本问题, 怀疑人生
这就是拿着半截就跑...
终于仔细检查发现
Error: getaddrinfo ENOTFOUND localhost
这才是罪魁祸首, 原来是公司的VPN修改了hosts
文件, 把localhost
干掉了
这篇关于docusaurus 启动出错 - Error: getaddrinfo ENOTFOUND localhost的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-04el-table 开启定时器下,表格的选中状态会消失是什么原因-icode9专业技术文章分享
- 2024-10-03如何安装和初始化飞牛私有云 fnOS?-icode9专业技术文章分享
- 2024-10-03如何安装 App 并连接到飞牛 NAS?-icode9专业技术文章分享
- 2024-10-03如何安装飞牛 TV 并连接到影视服务器?-icode9专业技术文章分享
- 2024-10-03如何在PVE和ESXI上安装飞牛私有云 fnOS?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS安装系统异常情况处理-icode9专业技术文章分享
- 2024-10-03飞牛NAS如何创建存储空间?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS硬盘会自动休眠吗?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS如何安装飞牛影视和创建媒体库?-icode9专业技术文章分享
- 2024-10-03fnOS国产最强NAS如何为家人朋友开通影视账号?-icode9专业技术文章分享