簡體   English   中英

Flutterfire 拋出 dart not found 錯誤

[英]Flutterfire throws a dart not found error

我正在關注flutter + firebase codelab,我一直在我的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 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

我可以通過直接調用 bin 來解決這個問題,如下所示:

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

這很奇怪,因為我通過~/.pub-cache/bin/flutterfire中指定的相同路徑調用 cli

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

我遇到了同樣的問題,所以我查看了在 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

我希望這個答案有幫助!!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM