Why does flutter packages get fail? Same directory cloned from github but on one pc package get fail - visual-studio-code

Cloned from github a flutter repo onto Laptop(win10) and Desktop (win7) but on Desktop package get fail with error code 1
First two images show success on laptop pc.
See Below Desktop Fails to get packages.
Where should I correct this on Desktop?
However, I can create new app without any error on Desktop.
Please help, Thank you.

I deleted the two log files and also pubspec.lock file and run Flutter Get Packages. This Resolved the issue. This agonizing error ate up few hours.

I tried
flutter clean
flutter packages get
it worked

Related

I am not able to use flutter as im getting an error with the dart sdk, only it has been working for weeks until today

I am currently having this issue and can't find any solutions that work. Yesterday It was running fine and this afternoon when I wanted to code I received this message in the terminal.
flutter run... Downloading Dart SDK from Flutter engine <<<<<<< HEAD 07c1eed46b9d9b58df78566e9b8b2e42e80d3380
92ae191c17a53144bf4d62f3863c110be08e3fd3
8f89f6505b941329a864fef1527243a72800bf4d... curl: (3) URL using bad/illegal format or missing URL
Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra/flutter/<<<<<<< HEAD 07c1eed46b9d9b58df78566e9b8b2e42e80d3380
92ae191c17a53144bf4d62f3863c110be08e3fd3
8f89f6505b941329a864fef1527243a72800bf4d/dart-sdk-linux-x64.zip If you're located in China, please see this page: https://flutter.dev/community/china
I am not using a VPN, am not from china, and as I said this was running yesterday. I have tried reinstalling the flutter package, tried redirecting to redoing the path in Linux, also tried to just clone the github/flutter repo but nothing. Please help
Found that there was an issue with a file in
flutter/bin/internal called engine.version that had the same text as the "head" issue as mentioned in the error code. I have replaced the file with the one from the flutter GitHub repo and the error has gone. will close the issue.
Replace the /flutter/bin/internal/engine.version with the one from this https://github.com/flutter/flutter/blob/master/bin/internal/engine.version
and then run
flutter doctor
I had the same issue, tried everything I found on the internet but nothing worked... Finally, went to the folder where my flutter installation was, deleted the flutter folder, downloaded the flutter sdk again and named the unzipped folder exactly as the previous one: flutter.
This worked for me, so if all else fails, you can try this one.
I was getting that error too. Fixed by fixing the line-endings using the dos2unix utility:
Install dos2unix with sudo apt install dos2unix
Then run this in terminal:
dos2unix ~/snap/flutter/common/flutter/bin/internal/engine.version

Package is not showing up in the dart packages folder even though it is installed

I have been having issues with installing this package https://pub.dev/packages/graphql_flutter/install one of it's dependencies is this graphql package https://pub.dev/packages/graphql. When i do pub get it installs en shows everything expect for the graphql package in the dart packages folders. I have tried to install the graphql package separately but the package still doesnt show up than. And the import still gives the error "Target of URI doesn't exist: 'package:graphql/client.dart'." But it does show up in flutter/.pub-cache/hosted/pub.dartlang.org so i dont understand why it doesnt show in my project. I have tried using flutter clean, flutter clean pub cache and androidstudio's invalidate caches/restart function to no avail. I have also tried restarting android studio and my pc multiple times. I have also tried it with androidstudio run as admin.
This is my pubspec.yaml
this is part of my Dart packages folder as you can see it does not show
And this is the pub.dartlang.org folder on my pc
It ended up getting randomly fixed after 3 days. I just started android studio up and tried it again and suddenly it worked. No idea what fixed it in the end
Seen this issue a few times. Open Task manager in windows and check for adb.exe. There should be one copy running. I had 2 copies so removed 1 and restarted the other.
right-click --> end task for both.
All ok then.
Reloading VS code worked for me..
Reloading can be done ---> Command + R for Mac.

Could not find a file named "pubspec.yaml" for flutter 1.12.13+hotfix.5

my application was working normally with flutter version1.9.1+hotfix.6
when I upgrade flutter to version1.12.13+hotfix.5
the error
Error generating build_script snapshot: Could not find a file named
"pubspec.yaml" in
"C:\Users\t.ghassan\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\analyzer-0.35.4".
appears for both the stable channel and the master channel
I didn't use analyzer package in my application
what to do to fix it?
I'm using windows 10
analyzer is used for all apps to allow flutter analyze command from CMD.
What you can do is:
Close all IDE or files related to you flutter project
Open "C:\Users\t.ghassan\AppData\Roaming\Pub\Cache" folder
Delete "hosted" folder
Open your project again and run flutter packages get
If this doesn't help let me know in the comments.

Update flutter dependencies in /.pub-cache

I erased in my folder .pub-cache/hosted/pub.dartlang.org/this_plugin
What is the command to update the dependencies inside pubsec.yaml? I believe it is
flutter packages get
The folder under .pub-cache is still not up to date.
Note: there was a pubspec.lock that I deleted
Disclaimer: By running the command below, have a really fast internet
connection or be ready to lose one hour of productive hours. ( it will
redownload every package every installed on your pc, and I mean each
and all of the versions of each packages)~TSR
flutter pub cache repair
or delete /Users/xxxxxxx/development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+3/ and run flutter packages get again.
if all the above things fail delete the cache folder or also check the version updated in the lock file (some time lock give me the problem with updating the version number)
PS:
Why flutter pub cache repair download every package version previously used?
Remove the package from dependencies in pubspec.yaml, run flutter packages get. And then add the package to dependencies again and running flutter packages get.This process has solved the problem for me in the past.
This steps worked for me
Delete the pubspec.lock file then run the command flutter pub get again.
Clearing the projects cache
You can empty the entire projects cache to reclaim extra disk space or remove problematic packages.
run flutter pub cache clean in terminal at project directory
The below steps worked for me.
Flutter installation corrupted
The Flutter install directory is in an inconsistent state and that causes all kinds of troubles.
Causes
Unclear
Ways to fix
Run the following commands in the Flutter install directory:
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
Corrupted cache
Especially with plugin packages, it was seen several times that the package in the pub cache was corrupted.
Symptoms
Usually syntax errors at build time about code in dependencies.
Causes
Unknown.
IDEs or editors used by developers might not prevent editing plugin files and when they navigate into plugin code they might accidentally modify the code.
Ways to fix
Run flutter pub cache repair
This might take quite some time and re-downloads every package in the cache, even outdated versions that might not be used anymore by any project on disk.
Delete ~/.pub-cache/hosted and/or ~/.pub-cache/git (for Git dependencies). This requires running flutter packages to get in all active projects on your machine afterward.
Delete a specific package or package version. Look up the exact path in the cache for a specific package in the .packages file of your project. For example for firebase_auth
Reference: https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#flutter-installation-corrupted

How to fix 'No pubspec.yaml file found' when flutter project in OneDrive folder?

Run flutter packages get or flutter run in the root of my project, and it prompts the following
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.
exit code 1
This problem only appears in the project located under the OneDrive folder.
I can run flutter projects elsewhere.
I want to know if someone has the same problem.
After I reinstalled win10 today, this problem disappeared. So I guess this is my personal reason.
There is actually a GitHub issue filed related to your issue. And current status is still open. But there is a workaround to fix this.
The author have been able to resolve the error when the app was moved out from "OneDrive"
Yayy! It worked fine when I moved it out of OneDrive folder. So while
in OneDrive, it works fine until you touch pubspec.yaml. Anyways, all
good now!
There is a possibility that the team is still working on the issue.