简体   繁体   English

Flutterfire 抛出 dart not found 错误

[英]Flutterfire throws a dart not found error

I'm following the flutter + firebase codelab, and I'm stuck at configuring firebase in my android app, I've already installed the flutterfire cli globally on my machine and exported the bin in my path.我正在关注flutter + firebase codelab,我一直在我的android应用程序中配置firebase,我已经在我的机器上全局安装了flutterfire cli并在我的路径中导出了bin。

export PATH="$PATH:~/source/flutter/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"

But still, the following error is thrown when I try to use the flutterfire cli.但是,当我尝试使用 flutterfire cli 时,仍然会引发以下错误。

flutterfire
/home/dio/.pub-cache/bin/flutterfire: 8: dart: not found

This error leads me to believe that dart is not installed on my system but....这个错误让我相信我的系统上没有安装 dart 但是....

dart
A command-line utility for Dart development.

Usage: dart <command|dart-file> [arguments]

Global options:
-h, --help                 Print this usage information.
-v, --verbose              Show additional command output.
    --version              Print the Dart SDK version.
    --enable-analytics     Enable analytics.
    --disable-analytics    Disable analytics.

Available commands:
  analyze    Analyze Dart code in a directory.
  compile    Compile Dart to various formats.
  create     Create a new Dart project.
  devtools   Open DevTools (optionally connecting to an existing application).
  doc        Generate API documentation for Dart projects.
  fix        Apply automated fixes to Dart source code.
  format     Idiomatically format Dart source code.
  migrate    Perform null safety migration on a project.
  pub        Work with packages.
  run        Run a Dart program.
  test       Run tests for a project.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.

Flutter doctor output:颤振医生输出:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.13.0-0.0.pre.271, on Pop!_OS 22.04 LTS 5.16.19-76051619-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[✓] Android Studio
[✓] VS Code (version 1.66.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

I was able to work around this issue by calling the bin directly, like so:我可以通过直接调用 bin 来解决这个问题,如下所示:

dart /home/foo/.pub-cache/global_packages/flutterfire_cli/bin/flutterfire.dart-2.17.0-239.0.dev.snapshot configure

This is weird since I'm calling the cli through the same path specified in at ~/.pub-cache/bin/flutterfire这很奇怪,因为我通过~/.pub-cache/bin/flutterfire中指定的相同路径调用 cli

  dart "/home/foo/.pub-cache/global_packages/flutterfire_cli/bin/flutterfire.dart-2.17.0-239.0.dev.snapshot" "$@"

I was facing this same problem, so I looked into the file that stores the code for flutter fire command in bash.我遇到了同样的问题,所以我查看了在 bash 中存储 flutter fire 命令代码的文件。

This file is stored in the ~/.pub-cache/bin/ I looked up the code inside this file.这个文件存储在 ~/.pub-cache/bin/ 我查了这个文件里面的代码。 What the code basically does is, it passes over whatever command that you have given, to this other command代码的基本作用是,它将您给出的任何命令传递给另一个命令

dart pub global run flutterfire_cli:flutterfire{your command}

So, if you want to run a command say, flutterfire configure , you can run it this way,所以,如果你想运行一个命令,比如flutterfire configure ,你可以这样运行它,

dart pub global run flutterfire_cli:flutterfire configure

I hope this answer helps!!.我希望这个答案有帮助!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM