简体   繁体   English

npx create-react-app 上的 Node.JS EBADF 错误

[英]Node.JS EBADF error on npx create-react-app

I've been trying to get started learning React on my Mac.我一直在尝试开始在我的 Mac 上学习 React。 When I try to run npx create-react-app my-app it gives the following error:当我尝试运行npx create-react-app my-app时,会出现以下错误:

`npm ERR! `npm 错误! code EBADF npm ERR!代码 EBADF npm 错误! syscall connect npm ERR!系统调用连接 npm 错误! errno EBADF npm ERR! errno EBADF npm 错误! request to https://registry.npmjs.org/create-react-app failed, reason: connect EBADF 104.16.18.35:443https://registry.npmjs.org/create-react-app的请求失败,原因:连接 EBADF 104.16.18.35:443

npm ERR: A complete log of this run can be found in: npm ERR! npm ERR:此运行的完整日志可在以下位置找到:npm ERR!
/Users/Jeremy/.npm/_logs/2022-08-09T06_30_08_356Z-debug-0.log` /Users/Jeremy/.npm/_logs/2022-08-09T06_30_08_356Z-debug-0.log`

I've tried uninstalling and reinstalling node - making sure it was up-todate, etc, but no luck.我已经尝试卸载并重新安装节点 - 确保它是最新的,等等,但没有运气。 I'm pretty stuck as a complete beginner just trying to follow a few tutorials.作为一个完整的初学者,我只是试图遵循一些教程。 Any help would be greatly appreciated.任何帮助将不胜感激。

When I've googled code EBADF, it seems not many people have this issue.当我用谷歌搜索代码 EBADF 时,似乎没有多少人有这个问题。 What am I missing?我错过了什么?

I figured it out.我想到了。 The issue was that I was using a VPN that restricted the web traffic to http://registry.npmjs.org/create-react-app .问题是我使用的 VPN 将 web 流量限制为http://registry.npmjs.org/create-react-app Once I disable the VPN, everything worked as expected.一旦我禁用 VPN,一切都按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM