Skip to content

MacOS Error: Could not find a file named "pubspec.yaml" in #1469

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
1 task
BerndWessels opened this issue May 18, 2018 · 14 comments
Closed
1 task

MacOS Error: Could not find a file named "pubspec.yaml" in #1469

BerndWessels opened this issue May 18, 2018 · 14 comments

Comments

@BerndWessels
Copy link

Hi

I cannot run pub run build_runner build on MacOS bash terminal (it works on Windows)

I get the following error:
Could not find a file named "pubspec.yaml" in "/Users/bernd/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7".

It seems to look into the totally wrong path for the pubspec.yaml.

But I am definitely running it in my project folder and the pubspec.yaml is definitely there. As I said, the exact same project works on Windows 10 but not on MacOS.

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.3.2, on Mac OS X 10.13.4 17E202, locale en-NZ)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3.1)
[✓] Android Studio (version 3.1)
[✓] Connected devices (1 available)
  • [Dart VM version: 2.0.0-dev.48.0.flutter-fe606f890b (Mon Apr 16 21:21:13 2018 +0000) on "macos_x64"] Dart SDK Version (dart --version)
  • [build_runner: 0.8.9 built_value_generator: 5.4.4] What package(s) from this repo you are using, and the version (i.e. build_runner 0.7.12)
    • If you are not sure, try checking your pubspec.lock file.
  • What builder(s) you are using (or writing yourself). Try to give a short summary of what they do.
  • [MacOSX] Whether you are using Windows, MacOSX, or Linux (if applicable)
  • [Flutter] Whether you are using Chrome, Safari, Firefox, Edge (if applicable)
  • [Pub 2.0.0-edge.c080951d45e79cd25df98036c4be835b284a269c] Any other packages or constraints we should know about
@jakemac53
Copy link
Contributor

We read pubspecs from all of your transitive dependencies as well, do you see a pubspec at /Users/bernd/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7/pubspec.yaml?

@BerndWessels
Copy link
Author

@jakemac53 hi

I have checked and the .pub-cache folder on my mac is at this path /Users/bernd/Development/flutter/.pub-cache

But the error says /Users/bernd/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7/pubspec.yaml

So somehow build_runner is confused because it believes .pub-cache is here
/Users/bernd/.pub-cache but it is actually here
/Users/bernd/Development/flutter/.pub-cache

I have no idea how that happens since I installed everything following the official flutter guides

And I have no idea how to fix this - I don't want to move folders around - I rather want build_runner to be able to figure out the right paths itself.

How can we fix this?

@natebosch
Copy link
Member

What is the content of your .packages file? We don't make any assumptions about the locations of packages so I think something might be off before the build starts.

@zoechi
Copy link
Contributor

zoechi commented May 19, 2018

If .pub-cache is in /Users/bernd/Development/flutter/.pub-cache you probably need
flutter packages pub run build_runner ... instead of pub run build_runner ...

@BerndWessels
Copy link
Author

@zoechi How do I use the flutter packages pub build_runner ? What's the difference ?

@natebosch .packages

# Generated by pub on 2018-05-18 21:22:13.413179.
analyzer:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.31.1/lib/
analyzer_plugin:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer_plugin-0.0.1-alpha.0/lib/
args:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.4.2/lib/
async:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.6/lib/
barback:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/barback-0.15.2+15/lib/
boolean_selector:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.3/lib/
build:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/build-0.12.5/lib/
build_config:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/build_config-0.2.6+2/lib/
build_resolvers:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/build_resolvers-0.2.0+2/lib/
build_runner:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-0.8.9/lib/
built_collection:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/built_collection-3.1.1/lib/
built_value:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/built_value-5.4.4/lib/
built_value_generator:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/built_value_generator-5.4.4/lib/
charcode:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.1/lib/
cli_util:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/cli_util-0.1.2+1/lib/
code_builder:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/code_builder-3.0.3/lib/
collection:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.6/lib/
convert:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.0.1/lib/
crypto:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.2+1/lib/
csslib:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.1/lib/
cupertino_icons:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/
dart_style:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.0.9+1/lib/
fixnum:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/fixnum-0.10.7/lib/
flutter:file:///Users/bernd/Development/flutter/packages/flutter/lib/
flutter_redux:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_redux-0.5.0/lib/
flutter_test:file:///Users/bernd/Development/flutter/packages/flutter_test/lib/
front_end:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.0-alpha.9/lib/
glob:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.1.5/lib/
graphs:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/graphs-0.1.2/lib/
html:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.13.3/lib/
http:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+16/lib/
http_multi_server:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.4/lib/
http_parser:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.1/lib/
io:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.2+1/lib/
isolate:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/isolate-1.1.0/lib/
js:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1/lib/
kernel:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.0-alpha.9/lib/
logging:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+1/lib/
matcher:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.1+4/lib/
meta:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.2/lib/
mime:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6/lib/
multi_server_socket:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.1/lib/
node_preamble:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.0/lib/
package_config:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.3/lib/
package_resolver:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.2/lib/
path:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.5.1/lib/
plugin:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+2/lib/
pool:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.3.4/lib/
pub_semver:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.3.6/lib/
quiver:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-0.29.0+1/lib/
redux:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/redux-3.0.0/lib/
shelf:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.2/lib/
shelf_packages_handler:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.3/lib/
shelf_static:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7/lib/
shelf_web_socket:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2/lib/
sky_engine:file:///Users/bernd/Development/flutter/bin/cache/pkg/sky_engine/lib/
source_gen:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/source_gen-0.8.1+1/lib/
source_map_stack_trace:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.4/lib/
source_maps:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.4/lib/
source_span:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.0/lib/
stack_trace:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.2/lib/
stream_channel:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.4/lib/
stream_transform:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/stream_transform-0.0.11/lib/
string_scanner:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.2/lib/
term_glyph:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.0/lib/
test:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/test-0.12.34/lib/
typed_data:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.5/lib/
utf:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+4/lib/
vector_math:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.6/lib/
watcher:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+7/lib/
web_socket_channel:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.7/lib/
yaml:file:///Users/bernd/Development/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.13/lib/
skipq:lib/

@zoechi
Copy link
Contributor

zoechi commented May 19, 2018

The difference is that flutter packages pub ... sets up a Flutter specific environment.

@BerndWessels
Copy link
Author

@zoechi Thanks but flutter packages pub run build_runner build gives this output

[INFO] Generating build script...
[INFO] Generating build script completed, took 622ms



You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues


NoSuchMethodError: No static getter 'terminal' declared in class 'StdioType'.
Receiver: StdioType
Tried calling: terminal
dart:core                                                       NoSuchMethodError._throwNew
package:build_runner/src/environment/io_environment.dart 67:35  _canPrompt
package:build_runner/src/environment/io_environment.dart 35:47  new IOEnvironment
package:build_runner/src/generate/build_impl.dart 77:11         build
package:build_runner/src/generate/build.dart 71:5               build
package:build_runner/src/entrypoint/build.dart 28:24            BuildCommand.run
package:args/command_runner.dart 194:27                         CommandRunner.runCommand
package:args/command_runner.dart 109:29                         CommandRunner.run.<fn>
dart:async                                                      new Future.sync
package:args/command_runner.dart 109:11                         CommandRunner.run
package:build_runner/src/entrypoint/run.dart 22:31              run
.dart_tool/build/entrypoint/build.dart 11:22                    main

pub finished with exit code 1
([email protected]) Bernds-MacBook-Air:skipq-consumer-mobile-app bernd$ 

Am I doing something wrong here?

@kevmoo
Copy link
Member

kevmoo commented May 19, 2018

You need to upgrade Flutter. You need a version w/ Dart SDK -dev.54 or later

@zoechi
Copy link
Contributor

zoechi commented May 20, 2018

flutter channel dev or flutter channel master

@BerndWessels
Copy link
Author

Thank you.

So basically

flutter channel dev
flutter upgrade
flutter packages pub run build_runner build

makes build runner work fine and I get my built_value files properly generated.

I fear that being on the dev channel might have unforeseen consequences and that makes me pretty nervous. But at least its clear now that the beta channel is just not there yet.

Thanks again, I'm really looking forward to the flutter 1.0 release.

@zoechi
Copy link
Contributor

zoechi commented May 21, 2018

dev channel is more stable than beta in my experience, because the newest stuff of everything is developed against dev because it contains the most recent features and bug fixes.

@BerndWessels
Copy link
Author

@zoechi hi, I switched over to my windows machine and did

flutter channel dev
flutter upgrade
flutter packages pub run build_runner build

but here I am getting:

Could not find bin\build_runner.dart in package build_runner.
pub finished with exit code 66

Any idea how to fix this?

@BerndWessels BerndWessels reopened this May 27, 2018
@BerndWessels
Copy link
Author

OK, no worries, I found a combination that worked for built_redux

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.0

  flutter_built_redux: 0.5.0
  built_redux: ^7.4.1-dev
  built_value: ^5.0.0
  built_collection: ^3.0.0

  firebase_core: ^0.2.3
  cloud_firestore: ^0.7.2

  rxdart: ^0.16.7

dev_dependencies:
  # flutter_test:
  #   sdk: flutter

  build: ^0.12.6
  build_runner: ^0.8.9
  built_value_generator: '>=4.1.0 < 6.0.0'
  source_gen: ^0.7.0

I hope that all gets less confusing and more stable after the first flutter release. At the moment everything seems to be changing with breaking changes all the time in so many interdependent packages.

@cohenadair
Copy link

cohenadair commented Mar 24, 2021

If .pub-cache is in /Users/bernd/Development/flutter/.pub-cache you probably need
flutter packages pub run build_runner ... instead of pub run build_runner ...

This worked for me, should really be in the documentation. It took me a while to find this.

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

6 participants