I'm having some difficulty with flutter within the VS Code tool.
I'm unable to update packages.
$ flutter packages get
Running "flutter packages get" in my_flutter_app...
Could not find a file named "pubspec.yaml" in "/Users/userName".
pub get failed (66)
I'm in the my_flutter_app directory, and clear as day in that directory root there is a file named "pubspec.yaml" . Why is the system looking for pubspec.yaml somewhere else, totally ignoring the pubspec.yaml right there? This doesn't make sense to me.
When I attempt to debug / run the program I get the following response in the Debug Console:
Running "flutter packages get" in my_flutter_app...
Could not find a file named "pubspec.yaml" in "/Users/userName".
pub get failed (66)
Exited (66)
Issue fail on both the terminal within VS code or within system bash terminal. Note: I'm using macOS, High Sierra, 10.13.6
$ flutter --version
Flutter 0.5.7-pre.111 • channel master • https://github.com/flutter/flutter.git
Framework • revision 7ebf2728dc (5 hours ago) • 2018-07-12 14:59:22 -0700
Engine • revision fed2ea458e
Tools • Dart 2.0.0-dev.67.0.flutter-84ca27a09e
Note: the answer from Could not find a file named "pubspec.yaml" in doesn't work here. Tried that, total fail.
Every Flutter project includes a pubspec. 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.
It is responsible for handling of importing images/fonts/third party packages which you want to include in your project. have you used android studio?
First, comment that the packaging line in the pubspec. yaml file and run flutter pub get after successfully get packages to uncomment that line (if you want to upgrade/downgrade to a specific version that mentioned version too) it will upgrade to the latest version.
This problem can happen when the main pubspec.yaml references a secondary pubspec.yaml which does not exist.
I met this problem in an example from flutter(vscode, mac os). The answer was found here. After that I did the following:
dev_dependencies:
image_picker:
path: ../
dev_dependencies:
image_picker: ^0.6.6+4
import 'package:flutter/material.dart';
//import 'package:flutter/src/widgets/basic.dart';
//import 'package:flutter/src/widgets/container.dart';
import 'package:image_picker/image_picker.dart';
import 'package:video_player/video_player.dart';
And everything worked without errors. The application launched perfectly on the smartphone.
Of course, this is in my case, as applied to flutter image_picker_example. In your case, there will be something else instead of image_picker.
Deleting the .pub-cache
folder solved my problem...
[my_expenses] flutter packages upgrade
Running "flutter pub upgrade" in my_expenses...
Could not find a file named "pubspec.yaml" in "/Users/charankumar/......../FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0".
pub upgrade failed (66)
exit code 66
$ rm -rf /Users/charankumar/......../FlutterSDK/flutter/.pub-cache/
[my_expenses] flutter packages get
Running "flutter pub get" in my_expenses... 13.0s
exit code 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With