firebase Flutterfire投掷 dart 未找到错误

vlju58qv  于 2023-02-09  发布在  Flutter
关注(0)|答案(3)|浏览(173)

我在flutter + firebase的代码实验室里,我在android应用程序里配置firebase时遇到了麻烦,我已经在我的机器上全局安装了flutterfire cli,并在我的路径中导出了bin。

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

但是,当我尝试使用flutterfire cli时,仍然会抛出以下错误。

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

这个错误使我相信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医生输出:

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
qgelzfjb

qgelzfjb1#

我也遇到了同样的问题,所以我查看了存储bash中flutter fire命令代码的文件。
这个文件存储在~/.pub-cache/bin/中,我查找了这个文件中的代码,代码的基本功能是,它将你给出的任何命令传递给另一个命令

dart pub global run flutterfire_cli:flutterfire{your command}

所以,如果你想运行一个命令,比如flutterfire configure,你可以这样运行它,

dart pub global run flutterfire_cli:flutterfire configure

希望这个答案能有所帮助!!。

m1m5dgzv

m1m5dgzv2#

我可以通过直接调用bin来解决这个问题,如下所示:

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

这很奇怪,因为我是通过在at ~/.pub-cache/bin/flutterfire中指定的相同路径调用cli的

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

rbl8hiat3#

您可以从/home/YOUR_USERNAME/.pub-cache/bin/flutterfire文件中删除第一行,flutterfire命令应该可以正常工作。

  • 删除此行:*
#!/usr/bin/env sh
  • 剩下的留着 *

另外,检查这个职位modify path,没有为我工作,虽然。

相关问题