3

我刚刚解决了所有必要的依赖项。

Building flutter tool...
Running pub upgrade...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.7.3, on Microsoft Windows [Version 10.0.17134.228], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2018.2)
[√] Connected devices (1 available)

现在,当我尝试在 Android Studio 上运行颤振应用程序时,我明白了。

A:\Project\flutter_app>flutter run
fatal: Not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Running "flutter packages get" in flutter_app...
Could not find a file named "pubspec.yaml" in "C:\".
pub get failed (66)

有谁知道如何解决这个问题?

2小时后更新

我使用 git repo https://github.com/flutter/flutter.git删除了颤振并重新安装在 *C:\flutter* 中

现在我得到的错误是这个

A:\Project\flutter_app>flutter run
fatal: Not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Running "flutter packages get" in flutter_app...
Cannot open file, path = '.\pubspec.lock' (OS Error: Access is denied.
, errno = 5)
pub get failed (66)

更新:我在运行flutter packages upgrade -v时尝试使用详细信息并得到了这个

C:\flutter\flutter_app>flutter packages upgrade -v
fatal: Not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
[  +31 ms] executing: [C:\Users\Nick\flutter\] git rev-parse --abbrev-ref --symbolic @{u}
[  +76 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +1 ms] origin/beta
[        ] executing: [C:\Users\Nick\flutter\] git rev-parse --abbrev-ref HEAD
[  +45 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +1 ms] beta
[        ] executing: [C:\Users\Nick\flutter\] git ls-remote --get-url origin
[  +38 ms] Exit code 0 from: git ls-remote --get-url origin
[   +9 ms] https://github.com/flutter/flutter.git
[        ] executing: [C:\Users\Nick\flutter\] git log -n 1 --pretty=format:%H
[  +38 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[   +1 ms] 3b309bda072a6b326e8aa4591a5836af600923ce
[   +7 ms] executing: [C:\Users\Nick\flutter\] git log -n 1 --pretty=format:%ar
[  +37 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[   +1 ms] 9 days ago
[        ] executing: [C:\Users\Nick\flutter\] git describe --match v*.*.* --first-parent --long --tags
[  +41 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[   +1 ms] v0.7.3-0-g3b309bda0
[ +170 ms] Running "flutter packages upgrade" in flutter_app...
[  +10 ms] executing: [C:\flutter\flutter_app\] C:\Users\Nick\flutter\bin\cache\dart-sdk\bin\pub.bat --verbosity=warning --verbose upgrade --no-precompile
[+16555 ms] Cannot open file, path = '.\pubspec.lock' (OS Error: Access is denied.
[   +1 ms] , errno = 5)
[  +46 ms] Running "flutter packages upgrade" in flutter_app... (completed)
[  +15 ms] "flutter upgrade" took 16,687ms.
pub upgrade failed (66)

#0      throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1      pub (package:flutter_tools/src/dart/pub.dart:170:5)
<asynchronous suspension>
#2      pubGet (package:flutter_tools/src/dart/pub.dart:104:13)
<asynchronous suspension>
#3      PackagesGetCommand._runPubGet (package:flutter_tools/src/commands/packages.dart:59:11)
<asynchronous suspension>
#4      PackagesGetCommand.runCommand (package:flutter_tools/src/commands/packages.dart:82:11)
<asynchronous suspension>
#5      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:356:18)
#6      _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#7      _rootRunUnary (dart:async/zone.dart:1132:38)
#8      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#9      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#10     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
#11     Future._propagateToListeners (dart:async/future_impl.dart:671:32)
#12     Future._complete (dart:async/future_impl.dart:476:7)
#13     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#14     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
#15     _rootRun (dart:async/zone.dart:1124:13)
#16     _CustomZone.run (dart:async/zone.dart:1021:19)
#17     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#18     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#19     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#20     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#21     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5) 

创建 GitHub 问题https://github.com/flutter/flutter/issues/21495

更新:没有太大改善

@pskink 要求我在使用详细信息时在空目录中创建一个新应用程序

输出:

C:\flutter>flutter create flutter_app -v
fatal: Not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Multiple output directories specified.
Try moving -v to be immediately following create

#0      throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1      CreateCommand.runCommand (package:flutter_tools/src/commands/create.dart:106:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:356:18)
#3      _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#4      _rootRunUnary (dart:async/zone.dart:1132:38)
#5      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#6      _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
#8      Future._propagateToListeners (dart:async/future_impl.dart:671:32)
#9      Future._complete (dart:async/future_impl.dart:476:7)
#10     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#11     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
#12     _rootRun (dart:async/zone.dart:1124:13)
#13     _CustomZone.run (dart:async/zone.dart:1021:19)
#14     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#15     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#17     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#18     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
4

6 回答 6

3

不要.packages从一台机器复制到另一台机器。.gitignore(如果使用 git ,它应该在里面。)

相反,在 mac 上运行 flutter packages get,它会重新创建.packages.

(不要复制.flutter-plugins either。)

  1. 删除.packages
  2. 删除pubspec.lock
  3. 运行以下命令,如图所示

运行以下命令,如图所示

于 2020-12-02T14:27:43.207 回答
0

从您的项目中删除 app/.packages 文件并使用 flutter upgrade 再次获取包。

于 2020-08-14T08:51:03.537 回答
0

我认为这是由过时的 Git 客户端引起的。

请确保您只有一个 Git 客户端PATH并且它是最新版本。

于 2018-09-06T16:42:12.453 回答
0

我找到了一个临时解决方案。当我以管理员身份在 Power Shell 上运行相同的命令时,它不会显示任何错误。

PS C:\flutter\flutter_app> flutter packages get
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Running "flutter packages get" in C:\...                    16.1s
PS C:\flutter\flutter_app> flutter packages upgrade
fatal: not a git repository (or any of the parent directories): .git
Building flutter tool...
Running pub upgrade...
Running "flutter packages upgrade" in C:\...                86.9s
于 2018-09-06T18:42:17.747 回答
0

这个问题与我的防病毒程序有关。当我卸载块时它起作用了。也许会有所帮助。祝大家工作顺利

于 2021-05-11T13:51:54.573 回答
0

杀死 dart.exe,尝试运行

如果仍然错误,杀死后,以管理员身份重新打开android studio

于 2019-08-19T07:21:23.440 回答