Flutter doctor: 无法下载 Dart SDK,在 Windows 中 BITS 服务失败

huangapple go评论88阅读模式
英文:

Flutter doctor: Unable to download dart sdk,BITS service failed in windows

问题

错误显示:

使用 BITS 服务下载 Dart SDK 失败,正在尝试使用 WebRequest 重试...
Invoke-WebRequest:底层连接已关闭:发送时发生意外错误。
在 C:\src\flutter\bin\internal\update_dart_sdk.ps1:68 字符:5
+ Invoke-WebRequest -Uri $dartSdkUrl -OutFile $dartSdkZip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo:InvalidOperation:(System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebExc
   eption
+ FullyQualifiedErrorId:WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

请帮忙,我是 Flutter 新手,需要帮助。

英文:

error showing:

Downloading the Dart SDK using the BITS service failed, retrying with WebRequest...
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At C:\src\flutter\bin\internal\update_dart_sdk.ps1:68 char:5
+     Invoke-WebRequest -Uri $dartSdkUrl -OutFile $dartSdkZip
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Please, I need help I'm new in flutter.

答案1

得分: 3

使用VPN,然后再次运行该命令。这对我起作用了。

英文:

use VPN and try running the command again. it worked for me.

答案2

得分: 1

我遇到了相同的问题。

你需要连接到互联网,然后在命令行或终端中运行以下命令:

flutter doctor

它应该会下载Dart SDK和一些其他工具。

我运行了flutter doctor后的输出:

Flutter doctor: 无法下载 Dart SDK,在 Windows 中 BITS 服务失败

英文:

I had the same problem.

You need to have access to internet and run then run

flutter doctor

from the command line or terminal. It should download the Dart SDK and some other tools.

My output after running flutter doctor:

Flutter doctor: 无法下载 Dart SDK,在 Windows 中 BITS 服务失败

答案3

得分: 1

不要运行升级的命令提示符 - 而是运行它作为用户命令提示符。

英文:

Don't run an elevated command prompt - run it as a user command prompt instead.

Flutter doctor: 无法下载 Dart SDK,在 Windows 中 BITS 服务失败

答案4

得分: 0

首先在终端中运行:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

然后 Dart SDK 在我的 MAC 上成功下载。

你需要将 PUB_HOSTED_URL=https://pub.flutter-io.cnFLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 添加到环境中。
再次尝试。

英文:

Firstly run in terminal:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

then dart sdk download successfully in my MAC.

You have to add PUB_HOSTED_URL=https://pub.flutter-io.cn && FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn in environment.
Try again.

答案5

得分: 0

只需使用管理员权限运行 cmd,然后运行 "flutter doctor" 命令。这对我有效。

英文:

just use cmd with administrator and run flutter doctor .
it worked for me.

答案6

得分: 0

Follow the steps below:
1- 只需以管理员身份使用 "cmd" 并运行 "flutter doctor"。
2- 如果仍然出现错误,请打开您的 VPN,然后再次尝试步骤 1。
您一定会成功的。

英文:

Follow the steps below:<br>
1- Just use "cmd" as administrator and run "flutter doctor".<br>
2- If you still get the error, open your VPN and try again the step 1.<br>
You will be certainly succeeded.

答案7

得分: -1

只需在管理员权限下的 PowerShell 中运行以下命令:

Flutter doctor

希望这能解决您的问题 :).

英文:

Simply run

> Flutter doctor

in the PowerShell as administrator.
I hope this resolves your issue :).

huangapple
  • 本文由 发表于 2020年1月3日 16:28:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575309.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定