我已删除 Pub\Cache\hosted\pub.dartlang.org 文件夹以更新颤振包,但在颤振包中显示错误获取

Posted

技术标签:

【中文标题】我已删除 Pub\\Cache\\hosted\\pub.dartlang.org 文件夹以更新颤振包,但在颤振包中显示错误获取【英文标题】:i have ddeleted Pub\Cache\hosted\pub.dartlang.org folder to update the flutter packages but showing error in flutter packages get我已删除 Pub\Cache\hosted\pub.dartlang.org 文件夹以更新颤振包,但在颤振包中显示错误获取 【发布时间】:2020-10-10 11:44:54 【问题描述】:

我尝试删除项目的颤振包并使用以下命令进行更新 但找不到解决方案,为什么这个包在“\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+2”文件夹中找到文件“pubspec.yaml”。这是错误。谁能告诉我如何从我项目的 pubspec.yaml" 文件中更新包

PS D:\flutter\delimeals> flutter packages get
Waiting for another flutter command to release the startup lock...
Could not find a file named "pubspec.yaml" in "C:\Users\omkar\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+2".
Running "flutter pub get" in delimeals...
pub get failed (66; Could not find a file named "pubspec.yaml" in
"C:\Users\omkar\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+2".)

我在删除 pub 文件夹后收到此错误,因为我想删除不需要的包。

PS D:\flutter\delimeals> flutter doctor -v
[√] Flutter (Channel stable, v1.17.3, on Microsoft Windows [Version 10.0.17763.1282], locale en-IN)
    • Flutter version 1.17.3 at D:\flutter\flutter
    • Framework revision b041144f83 (2 weeks ago), 2020-06-04 09:26:11 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4


[√] android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\omkar\AppData\Local\Android\Sdk
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = C:\Users\omkar\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.46.1)
    • VS Code at C:\Users\omkar\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.11.0

【问题讨论】:

【参考方案1】:

试试这个,

运行此命令flutter pub cache repair flutter clean(来自项目目录) 再次尝试运行

【讨论】:

以上是关于我已删除 Pub\Cache\hosted\pub.dartlang.org 文件夹以更新颤振包,但在颤振包中显示错误获取的主要内容,如果未能解决你的问题,请参考以下文章

为啥颤振本地化不能正常工作?

无法预编译 build_runner:build_runner:

升级我的颤振后如何修复以下错误

颤振医生没有在命令提示符下运行

添加依赖后无法在flutter 2.5.3中构建android模块

iOS - 删除我已删除的属性的引用