I am using Windows 10 with VS Code, although I also tested it on PowerShell, and both produced the same result:
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.
EDIT: 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.
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
UPDATE: I still don't know what caused the problem, but when I reinstalled flutter for Beta 3, it finally worked.
From Android Studio/IntelliJ: Click Packages get in the action ribbon at the top of pubspec. yaml . From VS Code: Click Get Packages located in right side of the action ribbon at the top of pubspec. yaml .
You can go to the pubspec. yaml file and add dependencies ,under dependencies and then packages get will do the work. or you can run flutter pub get in the terminal.
Looks like you are running flutter run command from a different directory (maybe parent directory).
Try running flutter run command from the project directory.
To solve this error in the EASIEST WAY follow below steps :-
Go to terminal
Then find local tabs
Then click on a '+' sign and type your command.This should solve your error
See this screenshot as a guide.
I had the same issue, then I realized by default, I was running flutter clean in my sub folder. Not the project folder. Definitely run as follows in the command terminal.
cd C:\Users*\Desktop*MyProject*my_project_flutter*
then run the following
Note: cd stands for Change directory I hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With