Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a file named "pubspec.yaml" in

Tags:

dart

dart-pub

I create a simple Web application but when I want to run it I got this message in "Tools Output":

Could not find a file named"pubspec.yaml"in"/home/reza/.pubcache/hosted/pub.dartlang.org/browser-0.10.0+2".

How can I fix this problem?

I use Ubuntu 14.04LTS 64bit and Dart Editor 1.7.2

like image 356
Reza Avatar asked Nov 30 '14 19:11

Reza


People also ask

Where is Pubspec Yaml?

yaml file, often referred to as the pubspec. A basic pubspec is generated when you create a new Flutter project. It's located at the top of the project tree and contains metadata about the project that the Dart and Flutter tooling needs to know.

How do I add packages to 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.

What is Pubspec lock file in flutter?

lock file lets you test your package against the latest compatible versions of its dependencies. For application packages, we recommend that you commit the pubspec.

Where are flutter packages installed?

If you are running Windows as your OS, you can find the packages under the folder that you installed your Flutter SDK to when setting up Android Studio. In my case - using Windows 10 - the path is as follows, where C:\ is my primary harddrive and flutter\ the folder containing the Flutter SDK...


2 Answers

This has happened to me several times:

What's ultimately solved things for me (OS X) is deleting pub's cache:

sudo rm -Rf /Users/<username>/.pub-cache

Also, delete the packages directory in your project's root:

sudo rm -Rf .packages

Then pub get again in your project(s), but make sure that you are not operating as root (a whoami will tell you, and an exit will get you out of there).

like image 157
David Notik Avatar answered Sep 19 '22 12:09

David Notik


run flutter clean and then flutter pub get

like image 34
jestrabikr Avatar answered Sep 19 '22 12:09

jestrabikr