【发布时间】:2014-06-08 15:17:50
【问题描述】:
我尝试将 three/three.dart 包从他们的 Git 存储库添加到我的项目中。正如here 所述,我这样做了。但是从编辑器运行 pub get 会出现以下错误:
Pub get failed, [1] Resolving dependencies... (0.1s)
Git error. Command: git fetch
fatal: Not a git repository (or any of the parent directories): .git
../../../../../../mnt/data/b/build/slave/dart-editor-linux-stable/build/dart/sdk/lib/_internal/pub/lib/src/git.dart 47 run.<fn>
dart:isolate _RawReceivePortImpl._handleMessage
This is an unexpected error. Please run
pub --trace 'get'
and include the results in a bug report on http://dartbug.com/new.
** Warning: Application may fail to run since packages did not get installed.Try running pub get again. **
Pub get failed, [1] Resolving dependencies... (0.1s)
Git error. Command: git fetch
fatal: Not a git repository (or any of the parent directories): .git
../../../../../../mnt/data/b/build/slave/dart-editor-linux-stable/build/dart/sdk/lib/_internal/pub/lib/src/git.dart 47 run.<fn>
dart:isolate _RawReceivePortImpl._handleMessage
This is an unexpected error. Please run
pub --trace 'get'
and include the results in a bug report on http://dartbug.com/new.
**
警告:由于未安装软件包,应用程序可能无法运行。请尝试再次运行 pub get。 **
我的系统上确实安装了 git。如果相关,我会运行 Ubuntu 14.04。
编辑: 我尝试了 pub --trace get 并得到了这个:
Resolving dependencies...
Git error. Command: git fetch
fatal: Not a git repository (or any of the parent directories): .git
随后是一条长日志消息。
这里是 pubspec.yaml 文件:
dependencies:
browser: any
three:
git:
url: 'git://github.com/threeDart/three.dart.git'
终于搞定了。我指定了版本以及 Git 存储库的 URL。这是我的最终发布规范:
dependencies:
browser: any
three:
git: git://github.com/threeDart/three.dart.git
version: '>=0.2.5+1 <0.3.0'
【问题讨论】:
-
我尝试了来自链接问题的依赖关系(问题的精确副本,而不是答案),它对我有用。你试过
pub --trace get吗? -
请将输出添加到您的问题中。评论不允许格式化文本。
-
很抱歉。我已经添加了输出。
-
您能否添加您的 pubspec.yaml 或至少添加您定义依赖项的部分。确保问题中的缩进与您的 pubspec.yaml 文件中的缩进完全相同。将文本添加到问题后选择文本,然后按工具栏中的
{}按钮将其格式化为代码。当您向下滚动时,您会看到一个预览,您可以在其中验证其格式是否正确。您能否在命令行中克隆 repo (git clone git://github.com/threeDart/three.dart.git) 并将结果也添加到您的问题中。 -
在我的 pubspec 文件中添加了依赖项。我之前确实克隆了存储库,它下载了 three.dart 文件夹到我的主目录。