Flutterfire 抛出 dart not found 错误

Jer*_*emy 3 path dart firebase flutter

我正在关注 flutter + firebase codelab,并且我一直在我的 android 应用程序中配置 firebase,我已经在我的计算机上全局安装了 flutterfire cli 并将 bin 导出到我的路径中。

\n
export PATH="$PATH:~/source/flutter/bin"\nexport PATH="$PATH":"$HOME/.pub-cache/bin"\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n
flutterfire\n/home/dio/.pub-cache/bin/flutterfire: 8: dart: not found\n
Run Code Online (Sandbox Code Playgroud)\n

这个错误让我相信我的系统上没有安装 dart,但是......

\n
dart\nA command-line utility for Dart development.\n\nUsage: dart <command|dart-file> [arguments]\n\nGlobal options:\n-h, --help                 Print this usage information.\n-v, --verbose              Show additional command output.\n    --version              Print the Dart SDK version.\n    --enable-analytics     Enable analytics.\n    --disable-analytics    Disable analytics.\n\nAvailable commands:\n  analyze    Analyze Dart code in a directory.\n  compile    Compile Dart to various formats.\n  create     Create a new Dart project.\n  devtools   Open DevTools (optionally connecting to an existing application).\n  doc        Generate API documentation for Dart projects.\n  fix        Apply automated fixes to Dart source code.\n  format     Idiomatically format Dart source code.\n  migrate    Perform null safety migration on a project.\n  pub        Work with packages.\n  run        Run a Dart program.\n  test       Run tests for a project.\n\nRun "dart help <command>" for more information about a command.\nSee https://dart.dev/tools/dart-tool for detailed documentation.\n
Run Code Online (Sandbox Code Playgroud)\n

颤振医生输出:

\n
flutter doctor\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] 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)\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)\n[\xe2\x9c\x97] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)\n    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.\n[\xe2\x9c\x93] Android Studio (version 2021.1)\n[\xe2\x9c\x93] Android Studio\n[\xe2\x9c\x93] VS Code (version 1.66.2)\n[\xe2\x9c\x93] Connected device (1 available)\n[\xe2\x9c\x93] HTTP Host Availability\n
Run Code Online (Sandbox Code Playgroud)\n

Bho*_*jay 12

我遇到了同样的问题,所以我查看了在 bash 中存储 flutter fire 命令代码的文件。

该文件存储在 ~/.pub-cache/bin/ 中我查找了该文件内的代码。该代码的基本作用是,它将您给出的任何命令传递给另一个命令

dart pub global run flutterfire_cli:flutterfire{your command}
Run Code Online (Sandbox Code Playgroud)

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

dart pub global run flutterfire_cli:flutterfire configure
Run Code Online (Sandbox Code Playgroud)

我希望这个答案有帮助!