如何修复“未找到pubspec.yaml文件"扑扑? [英] How do I fix "No pubspec.yaml file found" in flutter?

查看:94
本文介绍了如何修复“未找到pubspec.yaml文件"扑扑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我也在PowerShell上对其进行了测试,但我仍将Windows 10与VS Code一起使用,并且都产生了相同的结果:

I am using Windows 10 with VS Code, although I also tested it on PowerShell, and both produced the same result:

创建新的Flutter程序后,在编辑任何内容之前,我尝试在手机上运行它,因为教程说,但是我收到一条错误消息,提示找不到pubspec.yaml文件".我认为问题一定是默认的新应用程序设置存在问题,因此我使用了"flutter_gallery"示例.但是,这有完全相同的问题.我重新安装了flutter,自行安装了dart 2,删除了.pub-cache,但没有任何效果.我尝试使用Google搜索该问题,但找不到任何内容.

After creating a new flutter program, before editing anything, I tried to run it on my phone, as the Tutorial Says, but I get an error saying "No pubspec.yaml file found". I thought that the issue must be that the default new app setup having an issue, so I used the "flutter_gallery" example. However, this had the exact same issue. I have reinstalled flutter, installed dart 2 on its own, deleted .pub-cache, but nothing works. I tried Googling the issue, but I couldn't find anything.

我正在从flutter项目的根目录中运行命令,其中pubspec.yaml文件在其中,但仍然出现错误.完整的错误消息是:

I am running the commands from the root directory of the flutter project, where the pubspec.yaml file is, but I still get an error. The full error message is:

Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.

这是从项目根目录运行 dir 的结果:

here is the result of running dir from the root of the project:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
da---l       2018-04-11   3:45 PM                .idea
da---l       2018-04-11   3:45 PM                android
da---l       2018-04-11   3:45 PM                ios
da---l       2018-04-11   4:19 PM                lib
da---l       2018-04-11   3:45 PM                test
-a---l       2018-04-11   3:45 PM            120 .gitignore
-a---l       2018-04-11   3:45 PM            292 .metadata
-a---l       2018-04-11   3:45 PM           5425 .packages
-a---l       2018-04-11   3:45 PM            851 hello_world.iml
-a---l       2018-04-11   3:45 PM           1412 hello_world_android.iml
-a---l       2018-04-11   3:59 PM           8882 pubspec.lock
-a---l       2018-04-11   3:59 PM            358 pubspec.yaml
-a---l       2018-04-11   3:45 PM            160 README.md

更新:我仍然不知道是什么原因引起的,但是当我重新安装Beta 3的flutter时,它终于可以工作了.

UPDATE: I still don't know what caused the problem, but when I reinstalled flutter for Beta 3, it finally worked.

推荐答案

看起来您正在从其他目录(可能是父目录)运行 flutter run 命令.

Looks like you are running flutter run command from a different directory (maybe parent directory).

尝试从项目目录中运行 flutter run 命令.

Try running flutter run command from the project directory.

这篇关于如何修复“未找到pubspec.yaml文件"扑扑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆