【问题标题】:Create-React-App Unexpected Connection RefusedCreate-React-App 意外连接被拒绝
【发布时间】:2019-09-11 17:10:35
【问题描述】:

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

ECONNREFUSED 13.107.6.183:443

点击here查看完整日志

$ 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.

【问题讨论】:

  • 你检查“C:\\Users\\A778765\\source\\Dev\\testmeup\\yarn-error.log”了吗???
  • 是的,我在我的问题中附加了那个文件。
  • 抱歉,这不是安全链接

标签: reactjs create-react-app yarnpkg


【解决方案1】:

这似乎是代理设置的问题,因为当您运行 create-react-app <app_name> 时,yarn 无法解决设置新 react 项目所需的依赖项,即:reactreact-domreact-scripts

也许您可以尝试设置代理设置,以便安装create-react-app 需要的必要库。根据yarn'sdocumentation

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

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

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

&lt;proxy_url&gt; 更改为与您的适当代理一起使用。然后你可以告诉yarn 在必要时忽略 ssl。 注意:请自行决定使用。

yarn config set strict-ssl false

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

希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 2022-06-23
    • 2017-08-08
    • 1970-01-01
    • 2021-06-24
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 2014-10-29
    • 2020-07-04
    相关资源
    最近更新 更多