首页 > 解决方案 > Flutter Pub Get 命令添加依赖失败

问题描述

我正在处理一个颤振项目,当我尝试将新包或资产添加到 pubspec.yaml 文件并尝试使用“flutter pub get”命令添加依赖项时,该过程没有以退出代码 0 完成。我m 使用 VSCode。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

A:\Docs\Flutter\messenger>flutter pub get
Running "flutter pub get" in messenger...                           0.7s

A:\Docs\Flutter\messenger>

此外,如果我忽略获取退出代码,则依赖项不会反映在我的代码中,并带有错误消息引用

Try creating the file referenced by the URI, or Try using a URI for a file that does exist.darturi_does_not_exist

我也尝试过获取包按钮,但它也不好。当我尝试添加资产时,资产也会发生此问题

  assets:
    - assets\images\

它显示类似的错误代码

The asset assets\images\ does not exist.
Try creating the file or fixing the path to the file.

标签: androidflutterdart

解决方案


通常,当 pub get 给出错误时,它是其他给出错误的东西,而不是实际的“pub get”命令。在运行“pub get”命令之前,请确保您的项目中没有任何错误。由于您没有提供足够的信息,因此很难提供更多可能对您有所帮助的选项。如果您需要更多帮助,请出示您的代码/颤振医生。


推荐阅读