Create-React-App意外的连接被拒绝 [英] Create-React-App Unexpected Connection Refused

查看:88
本文介绍了Create-React-App意外的连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试简单地创建一个新的react应用时,我一直收到以下错误.我什至在计算机上设置了提琴手,并将代理设置为可以使用该提琴手,但是仍然出现以下错误:

I keep getting the below error when I try to simply create a new react app. I even set up fiddler on my computer and set my proxy to work with that but I am still getting the following error:

ECONNREFUSED 13.107.6.183:443

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.

推荐答案

自您运行 create-react-app<以来,这似乎是具有代理设置的问题.app_name> yarn 无法解决建立新的 react 项目所需的依赖关系,即: react react-dom react-scripts .

This appears to be an issue with your proxy settings since when you're running create-react-app <app_name> yarn is unable to resolve the necessary dependencies to set up your new react project, namely: react, react-dom, and react-scripts.

也许您可以尝试设置代理设置,以便安装 create-react-app 需要的必要库.根据 yarn的 文档:

Maybe you could try setting your proxy settings so you can install the necessary libraries create-react-app needs. According to yarn's documentation:

为了向后兼容npm,Yarn允许通过环境变量传递npm配置."

所以也许您可以尝试以下方法,看看这是否有助于解决您的问题:

So maybe you could try the following and seeing if this helps resolve your issue:

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

更改了< proxy_url> 以便与您合适的代理一起使用.然后,如有必要,您可以告诉 yarn 忽略ssl.注意:请自行决定使用.

where the <proxy_url> is changed to work with your appropriate proxy. Then you can tell yarn to ignore ssl if necessary. Note: Use at your own discretion.

yarn config set strict-ssl false

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

npm config set <key> <value> sets npm environment variables which yarn can also utilize. In this particular case we are setting the proxy environment variables. Now simply try running the create-react-app command again and it should be able to proceed with setting up the new react project for you.

希望有帮助!

这篇关于Create-React-App意外的连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆