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

Created on 26 Mar 2018  Â·  24Comments  Â·  Source: dart-lang/pub

i've got error like this when trying to install flutter.
i run
flutter doctor
and suddenly i got error like this :

This is an unexpected error. Please run

    pub --trace upgrade --verbosity=error --no-packages-dir

and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
Error: Unable to pub upgrade flutter tool. Retrying in five seconds...

i've got the log, and here it is:

Could not find a file named "pubspec.yaml" in "/home/sina".
---- Log transcript ----
FINE: Pub 1.24.3
ERR : Could not find a file named "pubspec.yaml" in "/home/sina".
FINE: Exception type: FileException
FINE: package:pub/src/pubspec.dart 419                                    new Pubspec.load
    | package:pub/src/package.dart 138                                    new Package.load
    | package:pub/src/entrypoint.dart 146                                 new Entrypoint
    | package:pub/src/command.dart 42                                     PubCommand.entrypoint
    | package:pub/src/command/upgrade.dart 41                             UpgradeCommand.run
    | package:args/command_runner.dart 194                                CommandRunner.runCommand
    | package:pub/src/command_runner.dart 168                             PubCommandRunner.runCommand.<fn>
    | dart:async                                                          new Future.sync
    | package:pub/src/utils.dart 102                                      captureErrors.<fn>
    | package:stack_trace                                                 Chain.capture
    | package:pub/src/utils.dart 117                                      captureErrors
    | package:pub/src/command_runner.dart 168                             PubCommandRunner.runCommand
    | package:pub/src/command_runner.dart 117                             PubCommandRunner.run
    | /tmp/tmpj91Zcx/dart-1.24.3/dart/third_party/pkg/pub/bin/pub.dart 8  main
    | ===== asynchronous gap ===========================
    | dart:async                                                          _Completer.completeError
    | package:pub/src/command/upgrade.dart 51                             UpgradeCommand.run
    | ===== asynchronous gap ===========================
    | dart:async                                                          new Future.microtask
    | package:pub/src/command/upgrade.dart 40                             UpgradeCommand.run
    | package:args/command_runner.dart 194                                CommandRunner.runCommand
    | ===== asynchronous gap ===========================
    | dart:async                                                          new Future.microtask
    | package:args/command_runner.dart 142                                CommandRunner.runCommand
    | package:pub/src/command_runner.dart 168                             PubCommandRunner.runCommand.<fn>
    | dart:async                                                          new Future.sync
    | package:pub/src/utils.dart 102                                      captureErrors.<fn>
    | package:stack_trace                                                 Chain.capture
    | package:pub/src/utils.dart 117                                      captureErrors
    | package:pub/src/command_runner.dart 168                             PubCommandRunner.runCommand
---- End log transcript ----

OS : Ubuntu 17.10

Most helpful comment

@nex3 @natebosch can this issue be reopened here? It looks like this error is caused by invalid pubspec.yaml and there should be a better error message from pub.

I saw an example where the first line had a few spaces before name: ... and flutter/flutter#15948 mentions examples with invalid path: ...

People run into this quite often.

All 24 comments

What Flutter version are you using?
flutter --version

@zoechi i got clone of the flutter repo today for installing it and i wasn't able to install it...and when i tried to run flutter --versioni got above error

Sounds like a network issue
You don't have by any chance a space in the Flutter install directory path?

yes, i just update my answer ... i got above error again trying to get version...
and i have enough space in install directory path for installation

@zoechi even deleting pub cache wasn't helpful. any idea ?

I wouldn't expect deleting pub cache to have effect

This issue was moved to flutter/flutter#15948

@nex3 @natebosch can this issue be reopened here? It looks like this error is caused by invalid pubspec.yaml and there should be a better error message from pub.

I saw an example where the first line had a few spaces before name: ... and flutter/flutter#15948 mentions examples with invalid path: ...

People run into this quite often.

cc @mit-mit to triage

There are actually 2 different cases (which I wasn't aware before)

Could not find a file named "pubspec.yaml"

A few I found in a Google search. Some are older but I think they show that in many situations the error message is not helpful. Perhaps there is a way to get more information about the root cause.

Update Seems there is another source of this error
caused by Chinese Pub mirror server being down or not responding properly for some other reason

  • #2076 (no valuable information but from the timing probably the same as
  • #2078
  • #1812

This is another open Pub issue with the same error

and there is a similar error message

Error: No pubspec.yaml file found.

which looks like it comes from Flutter https://github.com/flutter/flutter/search?q=%22No+pubspec.yaml+file+found%22&unscoped_q=%22No+pubspec.yaml+file+found%22

I just put this here to gather more information and perhaps find a pattern.

@zoechi did you come across a simple repro for this?

@mit-mit no, every attempt to reproduce failed so far.

There were 2 cases where fixing the content of pubspec.yaml seems to have solved it, but I wasn't able to reproduce that way.

Most other cases were broken ~/.pub-cache or where some radical actions like reinstalling Flutter seems to have fixed it.

Simple write in terminal ,
cd your project name // for windows
flutter run // use for run your application .

@mit-mit feel free to close. I won't have time to investigate further anytime soon.
We can reopen if new information emerges that would allow to track the cause down.

I am having this problem right now. I've already tried deleting the whole flutterdirectory but nothing works.

I noted that the library folder is created inside the hosted folder (inside the .pub-cache), but it's empty.

Any idea what may be causing this?

I am having the same problem.

Could not find a file named "pubspec.yaml" in "C:srcflutter.pub-cachehostedpub.dartlang.orgsqflite-0.13.0".

pub get failed (66)

I'm having an error Could not find a file named "pubspec.yaml" in "C:UsersiftekAppDataRoamingPubCachehostedpub.dartlang.orgquiver-2.0.1".

I had changed some git: dependencies to path: dependencies.

--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -18,19 +18,13 @@ dependencies:
   foo:
-    git:
-      url: [email protected]:myorg/foo.git
-      ref: mine
+    path: /Users/me/proj/flutter/foo

After reverting, I get the error.

--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -18,13 +18,19 @@ dependencies:
   foo:
-    path: /Users/me/proj/flutter/foo
+    git:
+      url: [email protected]:myorg/foo.git
+      ref: mine
$ flutter packages get
Could not find a file named "pubspec.yaml" in [email protected]:myorg/foo.git 6d8373ad034368c7247dc9c8c9ae324f5aa6afa3.

If I remove the .git suffix from the url, flutter packages get runs normally.

--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -19,17 +19,17 @@ dependencies:
   foo:
     git:
-      url: [email protected]:myorg/foo.git
+      url: [email protected]:myorg/foo

Remove .git work for me.

This is a pretty old, closed bug. If anyone is still experiencing issues, please file new issues (and kindly include as much information, repro steps, etc. as possible).

I reproduced it simply.
I create a basic flutter application, I then copy the following
audio_service:
path: ../

directly from the page : https://github.com/ryanheise/audio_service/blob/master/example/pubspec.yaml

Adding audio_service does not create the issue. Adding then "path: ../" brings:

Running "flutter pub get" in singing_buttons...
Could not find a file named "pubspec.yaml" in "...AndroidStudioProjects".
pub get failed (66; Could not find a file named "pubspec.yaml" in ".../AndroidStudioProjects".)
Process finished with exit code 66_

I create a basic flutter application, I then copy the following

audio_service:
   path: ../

That's always wrong.. unless you're doing it from the audio_service/example folder, you can't path import..

Hi, can really be, but tgere was a question about how to reproduce...

Le lun. 10 févr. 2020 à 13:05, Jonas Finnemann Jensen <
[email protected]> a écrit :

I create a basic flutter application, I then copy the following

audio_service:
path: ../

That's always wrong.. unless you're doing it from the
audio_service/example folder, you can't path import..

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dart-lang/pub/issues/1850?email_source=notifications&email_token=AA7AZ6UCSVEVJ35OU3CLIT3RCE7KBA5CNFSM4EXOIWS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELIIOZI#issuecomment-584091493,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA7AZ6TH23FCE44WAX4MYY3RCE7KBANCNFSM4EXOIWSQ
.

Instead of

audio_service:
   path: ../

remove the "path:" and just use
audio_service:
or the given version that you need.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Andersmholmgren picture Andersmholmgren  Â·  45Comments

goderbauer picture goderbauer  Â·  57Comments

wh120 picture wh120  Â·  24Comments

kasperpeulen picture kasperpeulen  Â·  27Comments

DartBot picture DartBot  Â·  72Comments