reactjs - Create-React-App 意外连接被拒绝
问题描述
当我尝试简单地创建一个新的反应应用程序时,我不断收到以下错误。我什至在我的计算机上设置了提琴手并将我的代理设置为使用它,但我仍然收到以下错误:
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
.
也许您可以尝试设置代理设置,以便安装所需的库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>
设置也可以使用的npm
环境变量yarn
。在这种特殊情况下,我们正在设置proxy
环境变量。现在只需尝试create-react-app
再次运行该命令,它应该能够继续为您设置新react
项目。
希望这会有所帮助!
推荐阅读
- swift - 如何在 Firebase 中更改电子邮件地址?
- algorithm - 你如何找到 N 个整数,使得它们的总和等于 M?
- deep-learning - 加速训练 - 在 PyTorch 中使用 LSTM 的 RNN
- debugging - 如何在 macOS 上的 vscode 上调试 C++ 时添加用户输入
- ruby - 有没有更好的方法来分配 Ruby 哈希,同时避免 RuboCop 的 ABC 大小警告?
- php - 使用 Guzzle 时 Laravel 通知不起作用
- xml - 在 XSL 中使用时区格式化日期
- wordpress - 用于从网络成员登录区域发送安全邮件/或消息的 Wordpress 插件
- reactjs - 如何为谷歌材料条形图制作动画
- spring - 跨多个过滤器在 Spring Cloud 网关中维护状态/上下文