Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sinadarvi opened this issue Mar 26, 2018 · 25 comments
Closed

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

sinadarvi opened this issue Mar 26, 2018 · 25 comments

Comments

@sinadarvi
Copy link

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

@zoechi
Copy link

zoechi commented Mar 26, 2018

What Flutter version are you using?
flutter --version

@sinadarvi
Copy link
Author

sinadarvi commented Mar 26, 2018

@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 --version i got above error

@zoechi
Copy link

zoechi commented Mar 26, 2018

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

@sinadarvi
Copy link
Author

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

@sinadarvi
Copy link
Author

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

@zoechi
Copy link

zoechi commented Mar 26, 2018

I wouldn't expect deleting pub cache to have effect

@nex3
Copy link
Member

nex3 commented Mar 26, 2018

This issue was moved to flutter/flutter#15948

@nex3 nex3 closed this as completed Mar 26, 2018
@zoechi
Copy link

zoechi commented Feb 8, 2019

@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.

@natebosch natebosch reopened this Feb 8, 2019
@natebosch
Copy link
Member

cc @mit-mit to triage

@zoechi
Copy link

zoechi commented Feb 14, 2019

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

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.

@mit-mit
Copy link
Member

mit-mit commented Feb 19, 2019

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

@zoechi
Copy link

zoechi commented Feb 19, 2019

@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.

@AshrafulalamRasel
Copy link

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

@zoechi
Copy link

zoechi commented Mar 12, 2019

@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.

@mit-mit mit-mit closed this as completed Mar 28, 2019
@shinayser
Copy link

shinayser commented May 2, 2019

I am having this problem right now. I've already tried deleting the whole flutter directory 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?

@Dhciolfi
Copy link

Dhciolfi commented May 4, 2019

I am having the same problem.

Could not find a file named "pubspec.yaml" in "C:\src\flutter.pub-cache\hosted\pub.dartlang.org\sqflite-0.13.0".

pub get failed (66)

@iftee939
Copy link

iftee939 commented May 7, 2019

I'm having an error Could not find a file named "pubspec.yaml" in "C:\Users\iftek\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\quiver-2.0.1".

@mockturtl
Copy link

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

@phattranky
Copy link

Remove .git work for me.

@mit-mit
Copy link
Member

mit-mit commented Jul 2, 2019

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).

@galyathee
Copy link

galyathee commented Feb 2, 2020

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_

@jonasfj
Copy link
Member

jonasfj commented Feb 10, 2020

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..

@galyathee
Copy link

galyathee commented Feb 10, 2020 via email

@mfrischbutter
Copy link

Instead of

audio_service:
   path: ../

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

@whoamisafal
Copy link

I got the solution

  1. First go to the \flutter.pub-cache\hosted\pub.dartlang.org
  2. Delete all the package
  3. Then Congrats your problem solved

The problem is due to the pubspec.yaml file missed in your package or plugins
This step work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests