Create-React-App 意外连接被拒绝

IT技术 reactjs create-react-app yarnpkg
2021-05-10 17:55:32

当我尝试简单地创建一个新的 React 应用程序时,我不断收到以下错误。我什至在我的计算机上设置了 fiddler 并将我的代理设置为使用它,但我仍然收到以下错误:

ECONNREFUSED 13.107.6.183:443

单击此处获取完整日志

$ create-react-app testmeup

Creating a new React app in C:\***\source\Dev\testmeup.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.15.2
[1/4] Resolving packages...
error An unexpected error occurred: "https://pkgs.dev.azure.com/AdmInvestorServices/_packaging/test/npm/registry/react: connect ECONNREFUSED 13.107.6.183:443".
info If you think this is a bug, please open a bug report with the information provided in "C:\\****\\source\\Dev\\testmeup\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\***\Dev\testmeup has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
1个回答

这似乎是一个与你的代理服务器设置的问题,因为当你正在运行create-react-app <app_name> yarn不能解决必要的依赖,以建立新react的项目,即:reactreact-dom,和react-scripts

也许您可以尝试设置代理设置,以便安装所需的库create-react-app根据yarn's 文档

“为了与 npm 向后兼容,Yarn 允许通过环境变量传递 npm 配置。”

因此,也许您可​​以尝试以下操作,看看这是否有助于解决您的问题:

npm config set proxy <proxy_url>
npm config set https-proxy <proxy_url>

<proxy_url>改变工作与适当的代理。然后,您可以yarn在必要时忽略 ssl。注意:请自行决定使用。

yarn config set strict-ssl false

npm config set <key> <value>设置npmyarn可以使用的环境变量在这种特殊情况下,我们正在设置proxy环境变量。现在只需尝试create-react-app再次运行该命令,它应该能够继续react为您设置新项目。

希望这有帮助!