找不到名为"pubspec.yaml"的文件;在"/Users/userName"中 [英] Could not find a file named "pubspec.yaml" in "/Users/userName"

查看:479
本文介绍了找不到名为"pubspec.yaml"的文件;在"/Users/userName"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS Code工具中的抖动有些困难.

I'm having some difficulty with flutter within the VS Code tool.

我无法更新软件包.

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

我位于my_flutter_app目录中,并清除为该目录根中的日期,即名为pubspec.yaml的文件.为什么系统在其他地方寻找pubspec.yaml而完全忽略那里的pubspec.yaml?这对我来说没有意义.

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)

在VS代码内的终端或系统bash终端上的发布均失败.注意:我使用的是macOS,High Sierra,10.13.6

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

注意:的答案找不到名为"pubspec.yaml" in 在这里不起作用.试过了,彻底失败了.

Note: the answer from Could not find a file named "pubspec.yaml" in doesn't work here. Tried that, total fail.

推荐答案

当主pubspec.yaml引用不存在的辅助pubspec.yaml时,可能会发生此问题.

This problem can happen when the main pubspec.yaml references a secondary pubspec.yaml which does not exist.

我在来自颤振的示例中遇到了这个问题(vscode,mac os). 在此处找到了答案. 之后,我执行了以下操作:

I met this problem in an example from flutter(vscode, mac os). The answer was found here. After that I did the following:

  1. 从pubspec.yaml中删除:

dev_dependencies:

  image_picker:
    path: ../

  1. 相反,将其插入pubspec.yaml:

dev_dependencies:

  image_picker: ^0.6.6+4

  1. 在main.dart中,注释了两行,其中包含"/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.

当然,就我而言,这适用于 flutter image_picker_example .对于您而言,除了 image_picker 之外,还会有其他内容.

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.

这篇关于找不到名为"pubspec.yaml"的文件;在"/Users/userName"中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆