I changed nothing, just worked on my Flutter Aplication, after the day i wanted to flutter run --release my app, but it didn't worked and i got this error message: Target file "lib\main.dart" not found. The day before everything worked fine. After a couple of times i tried it on another app, where i didn't changed something for a couple of days. But some of my other apps are working fine. The normal running in Android Studio is working normally on every app. Does anybody knwo what's the problem here?
My Error
My Directory
You are probably running your command on a different directory. Check your directory using pwd command on terminal.
Edit: As you use windows, make sure you open command line in your project directory.
See this tutorial.
https://www.lifewire.com/open-command-prompt-in-a-folder-5185505
Related
I recently tried running flutter upgrade and it seemed to run successfully. But after that the flutter command itself stopped working. Every time I try to run a flutter command it gives this error
'sysctl -n hw.optional.arm64' returned unexpected output: ''
I'm using a MacBook Pro with an Intel i7 processor.
I couldn't find anything on this error online. I also tried doing a git reset and a git pull on the flutter (core) directory. Nothing seems to help.
What could the issue be?
I managed to fix it. For some reason after upgrading flutter the path variable got messed up, at least in my .zshrc file. So I had to go and add the usr/sbin path to the PATH variable. That's where the sysctl program sits and that's why it was giving an error that the output is empty.
Hope this helps someone.
I'm relatively new to Flutter but I already have developed and finished some Apps in Flutter.
Recently I noticed a weird behavior of commands with the keywords "dart" or "flutter" in it.
Here is an example:
I was trying to migrate an existing project to the new dart null-safety and typed the command dart migrate into my Visual-Studio-Code Terminal.
I was expecting an output like Migrating C:\.... as a response but instead got these three lines:
The command "git" is either misspelled or could not be found.
Building flutter tool...
Running pub upgrade...
and then the expected output:
Migrating C:\<project path>...
and so on.
So basically the commands work as they would normally do but I get these three lines before the output everytime. And it's not only with this command. Also basic commands like dart help or flutter doctor will get these three lines.
I don't know what I am doing wrong. I uninstalled Flutter and also removed it from the PATH and then reinstalled it freshly but it's still the same. I also searched the web but didn't found anyone who has the same problem.
Any help and explanation would be great. Thank you for your time :)
I think I know where the problem is. I ran the commands directly when I opened PowerShell. But the directory was something like C:\Windows\ and then it won't work.
After I did cd C:\Users\User all commands will work as expected.
I was just thinking that it doesn't matter from where I run dartand fluttercommands obviously you have to be in your user directory that they will work properly.
I have a serious issue trying to install flutter... The pub upgrade when you run flutter doctor have being running for the past one hour on my system... I have being stuck with this issue since yesterday i don't know what the exact problem is... I have tried installing via Android Studio and through command line... It ends up getting stuck at "Running Pub Upgrade"...
Here are a few things you can try,
Close Android studio,
Open Task Manager and see if any Dart/Flutter services are running, if yes then close them.
Clear cache from flutter/bin folder.
and now run again.
I was a able to solve this problem, by downloading the flutter zip file in the flutter website, adding flutter/bin directory to my environment variables Path, restarting my system and running flutter doctor...
I also encountered the same problem, but I solved it using another computer,
what I did was;
I cleared my cache folder in flutter/bin folder
then I copied the folder containing flutter SDK into another computer *C:* drive so the folder was like C:\src\flutter on the other computer(which was windows also), opened the folder, opened flutter console, and run flutter doctor. it worked fine on that computer, everything was in place, so I copied that same folder again back into my computer, replacing all exiting files and run flutter doctor on my computer and it worked for me.
I also had this problem. It was stuck on "Running pub upgrade..." for more than 24 hours.
On this GitHub thread someone solved it by turning Anti-virus shields off. [https://github.com/flutter/flutter/issues/61719][1] (Stuck at Running pub upgrade)
This solved the issue for me. I closed Windows PowerShell, and turned off Avast Anti-virus shields. I re-opened Windows PowerShell, ran flutter doctor and all went through perfectly with no issues.
I am running flutter on my windows machine, it was working earlier and I have created demo project with it.
Today when I run VSCode it asked me to update flutter and I did, but when it is updated it is not able to run any command. It doesn't do anything, neither error nor success. It just get stucked with any flutter command.
Note : It was working earlier, so there is no chance of setting environment variables, still I have double checked it and it is there.
I did not find any solution for this so the last available approach for me was to reinstall flutter SDK and it worked.
Note: If you are windows user, you might get an error about PowerShell version, you must have PowerShell version greater than 5.1
I tried to follow Get Stated here https://flutter.io/setup-windows/
And got
>flutter run
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.
How to fix?
You are not in the current working directory. Change the directory to your project directory and then run >>flutter run so that it could find pubspec.yaml.
Download the zip file (Assuming you have already done this)
Extract this zip to a safe place say "E://flutter/"
Open CMD and goto your workspace folder where to usually create your projects.
Run command flutter create <project_name>
cd <project_name>
Run command flutter run
Alternatively, you can always use a good IDE like Intellij or Android Studio which will automate such configs like #Rechard said.
If you are trying to run any command in terminal and getting error of pubspec.ymal not found then Close that session of terminal that you are currently using and open a new one...
I've also faced with this problem recently. I researched it a little bit and actually there is no particular solution for that problem.
But the way I solved it was:
1) Forget about the file which gives the error.
2) Create a new one like how you've created before.
3) After that call the flutter run thing again. It should work as it worked for me.
For me i just went to the terminal, cd to the directory where you want to get the dependencies and just run 'flutter pub get'.
Try pressing Ctrl+Shift+T to open new session.