Could not find a file named "pubspec.yaml" in "/Users/userName"
Answer a question
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.
Answers
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:
- From the pubspec.yaml deleted:
dev_dependencies:
image_picker:
path: ../
- Instead, inserted into the pubspec.yaml:
dev_dependencies:
image_picker: ^0.6.6+4
- In the main.dart commented out two lines containing "/src/widgets/":
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.
更多推荐
所有评论(0)