简体   繁体   English

当我想获得 package flutter 时,它会显示 HTTP 错误 403:禁止访问

[英]When I wnat to get package flutter it show me HTTP error 403: Forbidden

I am working on flutter project in Intellij Idea.我正在 Intellij Idea 中从事 flutter 项目。 when I want to add a package in pubspec.yaml, it leads to below errror:当我想在 pubspec.yaml 中添加 package 时,它会导致以下错误:

HTTP error 403: Forbidden


package:pub/src/http.dart 218:5                 _ThrowingClient.send
===== asynchronous gap ===========================
package:http_throttle/http_throttle.dart 33:31  ThrottleClient.send
===== asynchronous gap ===========================
package:pub/src/source/hosted.dart 322:37       BoundHostedSource._download
===== asynchronous gap ===========================
package:pub/src/source/hosted.dart 217:13       BoundHostedSource.downloadToSystemCache
===== asynchronous gap ===========================
package:pub/src/entrypoint.dart 374:48          Entrypoint._get.<fn>

===== asynchronous gap ===========================
dart:async                                      runZoned
package:pub/src/http.dart 272:10                withDependencyType
package:pub/src/entrypoint.dart 370:12          Entrypoint._get
dart:async                                      Future.wait
package:pub/src/entrypoint.dart 231:18          Entrypoint.acquireDependencies
dart:async                                      _completeOnAsyncReturn
package:pub/src/solver/version_solver.dart      VersionSolver.solve
dart:async                                      _completeOnAsyncReturn
package:pub/src/solver/version_solver.dart      VersionSolver._result
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

I have tried using vpn and without vpn both of them doesnt work.我试过使用 vpn 和没有 vpn 两者都不起作用。 Also, when i add some common package such as provider or http, its fine.此外,当我添加一些常见的 package(例如提供商或 http)时,它很好。

This is my code:这是我的代码:

dependencies:
 flutter:
     sdk: flutter
 flutter_localizations:
     sdk: flutter

 provider: ^3.2.0
 http: ^0.12.0+2
 font_awesome_flutter: ^8.5.0
 flutter_rating_bar: ^3.0.0

my flutter sdk version: flutter_windows_v1.9.1+hotfix.6-stable_3我的 flutter sdk 版本:flutter_windows_v1.9.1+hotfix.6-stable_3

Could you please help me?请你帮助我好吗?

Thanks in advance提前致谢

same problem happened for me so i just did同样的问题发生在我身上所以我就做了

1:flutter clean 1:flutter 清洁

2:use 2 vpn at same time 2:同时使用2个VPN

this problem happened because of your connection;)这个问题是由于您的连接而发生的;)

It may solve your problem:它可能会解决您的问题:

  1. add ".catch-pub" folder in your current project在当前项目中添加“.catch-pub”文件夹
  2. add global environment variable "PUB_HOSTED_URL" with value "https://pub.dev/"添加值为“https://pub.dev/”的全局环境变量“PUB_HOSTED_URL

I had exactly the same problem and changed a few VPN , but it was still a problem and did not work我遇到了完全相同的问题并更改了几个VPN ,但它仍然是一个问题并且没有用

I used a service that changed DNS to fix the problem of sanctions and the problem was solved我用了一个改DNS的服务来修复sanctions的问题,问题解决了

After hours of trying to solve this problem, I finally found a solution.经过数小时的尝试解决这个问题,我终于找到了解决方案。

First, you have to delete all the packages of project from pubspec.yaml file (you can comment these lines, so you don't forget what's packages used)首先,你必须从pubspec.yaml文件中删除项目的所有包(你可以注释这些行,这样你就不会忘记使用了什么包)

then add all the packages to the project from cmd with this command:然后使用以下命令将所有包从cmd添加到项目中:

flutter pub add <package_name>

Make sure to use cmd, not powershell.确保使用 cmd,而不是 powershell。

I hope this solution works for you.我希望这个解决方案对你有用。

It often related to VPN connection.它通常与 VPN 连接有关。 before running flutter pub get , being sure that you can open https://developer.android.com/ site.在运行flutter pub get之前,请确保您可以打开https://developer.android.com/站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的 Android WebView 显示 403 Forbidden Error - Why is my Android WebView showing me an 403 Forbidden Error Openstreetmap HTTP / 1.1 403禁止 - Openstreetmap HTTP/1.1 403 Forbidden 当我更新gradle SDK时,弹出错误,是服务器禁止状态中的已接收状态代码403 - When i update gradle SDK's, popup the error is Recieved status code 403 from server-Forbidden 尝试在php中使用get变量调用URL时禁止403 - 403 forbidden when trying to call a URL using get variable in php 使用volley和php将android连接到mysql时禁止错误403 - error 403 forbidden when connecting android to mysql using volley and php 执行Android Google日历快速入门时出现403禁止错误 - 403 Forbidden Error when doing Android Google Calendar Quickstart 与 Firebase 安装服务器通信时出错 API - 403 Forbidden - Error when communicating with the Firebase Installations server API - 403 Forbidden 为什么我收到 403 Forbidden Request 错误? - Why am I getting 403 Forbidden Request Error? Flutter - 添加 import &#39;package:path/path.dart&#39; 时出错 - Flutter - I get error when i add import 'package:path/path.dart' 媒体播放器禁止错误(403) - Media Player Forbidden Error (403)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM