Flutter在代理后面失败:代理无法建立隧道(需要407代理身份验证)

时间:2019-05-14 20:35:11

标签: macos dart flutter

我刚刚开始设置Flutter以在Mac上运行。我从公司代理后面跑,每次尝试运行 flutter create app我看到了pub get failed

我在bash个人资料中正确设置了代理设置:

export HTTP_PROXY="http://[myUsername]:[myPassword]@[myProxy]:[myPort]"
export HTTPS_PROXY=$HTTP_PROXY
export ALL_PROXY=$HTTP_PROXY
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTP_PROXY
export all_proxy=$HTTP_PROXY
export GRPC_PROXY_EXP=$HTTP_PROXY
export grpc_proxy_exp=$HTTP_PROXY
export NO_PROXY=localhost,126.0.0.0,127.0.0.1
export STRICT_SSL=false
export strict_ssl=$STRICT_SSL
export NODE_TLS_REJECT_UNAUTHORIZED=0
export node_tls_reject_unauthorized=$NODE_TLS_REJECT_UNAUTHORIZED

运行flutter doctor时,我看到我的代理已正确设置:

✓] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,126.0.0.0,127.0.0.1
    • NO_PROXY contains 127.0.0.1
    • NO_PROXY contains localhost

在查看Github问题时,我看到其他人遇到了the exact same problems,但没有任何解决方案。

我当前的错误:

Proxy failed to establish tunnel (407 Proxy Authentication Required)    
package:pub/src/source/hosted.dart 349:7                                BoundHostedSource._throwFriendlyError
package:pub/src/source/hosted.dart 150:7                                BoundHostedSource.doGetVersions
===== asynchronous gap ===========================                      
package:pub/src/source.dart 167:12                                      BoundSource.getVersions
package:pub/src/solver/package_lister.dart 76:44                        PackageLister._versions.<fn>.<fn>
dart:async                                                              runZoned
package:pub/src/http.dart 272:10                                        withDependencyType
package:pub/src/solver/package_lister.dart 75:33                        PackageLister._versions.<fn>
===== asynchronous gap ===========================                      
dart:async                                                              new Future.sync
package:async/src/async_memoizer.dart 43:42                             AsyncMemoizer.runOnce
package:pub/src/solver/package_lister.dart 74:58                        PackageLister._versions
package:pub/src/solver/package_lister.dart 111:21                       PackageLister.countVersions
===== asynchronous gap ===========================                      
package:pub/src/solver/version_solver.dart 354:44                       VersionSolver._choosePackageVersion.<fn>
===== asynchronous gap ===========================                      
package:pub/src/utils.dart 301:39                                       minByAsync
===== asynchronous gap ===========================                      
package:pub/src/solver/version_solver.dart 350:25                       VersionSolver._choosePackageVersion
===== asynchronous gap ===========================                      
package:pub/src/solver/version_solver.dart 97:22                        VersionSolver.solve
===== asynchronous gap ===========================                      
package:pub/src/solver.dart 35:10                                       resolveVersions.<fn>
package:pub/src/log.dart 378:18                                         progress
package:pub/src/solver.dart 32:10                                       resolveVersions
package:pub/src/entrypoint.dart 203:24                                  Entrypoint.acquireDependencies
===== asynchronous gap ===========================                      
package:pub/src/command/get.dart 41:23                                  GetCommand.run
package:args/command_runner.dart 194:27                                 CommandRunner.runCommand
===== asynchronous gap ===========================                      
package:pub/src/command_runner.dart 171:39                              PubCommandRunner.runCommand.<fn>
dart:async                                                              new Future.sync
package:pub/src/utils.dart 109:12                                       captureErrors.<fn>
dart:async                                                              runZoned
package:pub/src/utils.dart 126:5                                        captureErrors
package:pub/src/command_runner.dart 171:13                              PubCommandRunner.runCommand
===== asynchronous gap ===========================                      
package:pub/src/command_runner.dart 119:11                              PubCommandRunner.run
===== asynchronous gap ===========================                      
/b/s/w/ir/k/src/third_party/dart/third_party/pkg/pub/bin/pub.dart 8:22  main
This is an unexpected error. Please run                                 

    pub --trace '--verbosity=warning' get --no-precompile               

and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
Running "flutter packages get" in my_app...                             
pub get failed (1)

我才刚刚开始使用Flutter,但不确定是否与Flutter或Dart有关。

1 个答案:

答案 0 :(得分:0)

https://pub.dartlang.org添加到您的代理规则中,我对此进行了修复