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

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.

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.

React Native Error Advice - The development server returned response error code:500

I am using React Native and encountered the following error on my android emulator
I am new to React Native and was coding in App.js. I watched a tutorial online on how to use react-navigation so I was following it and created a homestack.js file. My app.js file was still working perfectly fine at this point.
I added code to homestack.js and then imported it to my app.js file but that's when this error popped up. This error was not resolved when I commented out all of the code on homestack.js nor when I commented out the import on my app.js file.
I followed the instructions on the error (clear watchman, delete node modules, yarn install, yarn reset cache) but this also did not resolve the issue.
The fix:
Since none of the above fixed the issue, I removed the homestack.js file from my root folder completely which then fixed the issue. What I did not expect however was that when I put the homestack.js file back into the root folder to see what would happen, the app ran again fine with no issues. It was as if the error never happened.
I guess my question is, what was the actual issue here? Why did taking the file out of the folder and then placing it back in fix the issue? I ran 'npx react-native run-android' after every step of the above fix process so the issue was not because the emulator was running an old version.
Following this error, You have imported react-navigation-stack without install the package. You can install the packge
yarn add react-navigation-stack #react-native-community/masked-view react-native-safe-area-context
or
npm install react-navigation-stack #react-native-community/masked-view react-native-safe-area-context
To know more https://www.npmjs.com/package/react-navigation-stack
After install the package clean project by executing command cd android && gradlew clean, then debug your project.

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

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

Getting Flutter doctor to work

How do I get flutter doctor on my Windows 10 laptop to work, please?
I followed the guidelines here,
Used git to clone the flutter repository,
git clone -b alpha https://github.com/flutter/flutter.git,
Tried adding "C:\Users\<user>\flutter\bin" to my path in the Control Panel
and then in an Admin Powershell, tried executing flutter doctor.
At first, it just hung.
After googling for help, I tried deleting the contents of the
C:\Users\<user>\flutter\bin\cache folder and re-executing flutter doctor but to no avail.
Then, I tried deleting all of flutter and cloning again but flutter doctor just hung again but with, Updating flutter tool.
Tried a few different Googled PATH-adding ideas (that seems to be a complex and disputed area.)
Got a new message: Waiting for another flutter command to release the startuplock
The latest state is that flutter doctor still just hangs but without any message.
I suspect the problem lies in the new Path not being properly recognised (in the registers??)
Can anyone help please?
Well, the issue is not clear enough, but this might be solution, if your flutter doctor is stuck, it might be due to Background Intelligent Transfer Service is disabled, in order to check for yourself, do the following:
Click on the start menu, and then start typing services.
Launch the services and look for Background Intelligent Transfer Service and make sure it is running.
At this stage I believe you will find it disabled for some reason, just right click on it and go to properties and start the service, also change the startup type to automatic.
I can not think of other reasons that might prevent flutter doctor to run for the first time on a Windows machine other than that honestly.
I know this question is a little bit old. Here is a solution that worked for me. Run the Command Prompt as an admin solved the issue for me.
For Windows user check to see if the unzipped flutter folder is read only. (i.e right click the folder then properties then in the attributes section untick the readonly property then apply this change to the folder along with the sub-folders then ok and thats it. Worked for me.
Some errors I got and how I fixed it:
(ERROR 1):
[flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file.
Error: Unable to find git in your PATH. exit code 1
(Fix) - Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says:
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines:
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2):
flutter doctor takes too long
(Fix) - I downloaded the previous version of the sdk it worked like a charm.
(ERROR 3):
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(Fix):
Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked.
(ERROR 4):
The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(Fix) - Put the correct part in the env variables. I had put D:\flutter instead of D:\flutter\bin. That worked.
I got a solution that worked for me
initially i had downloaded the 2.2.5 SDK which gave the forever run error so i went back and downloaded the previous version ie 2.2.2 it worked like a charm
The Flutter SDK is installed in a protected folder and may not function correctly. Please move the SDK to a location that is user-writable without Administration permissions and restart.