'No active package flutterfire_cli

I have a Linux machine where I installed Flutter via Snap. I want to set up Crashlytics on my project. One of the steps is to install flutterfire_cli as stated here.

I have installed it a bit different via flutter pub global activate flutterfire_cli, which installed it under $HOME/snap/flutter/common/flutter/.pub-cache/bin. I added it in PATH. I can get the command on terminal.

However, flutterfire_cli fails (even with --help or --version) saying "No active package flutterfire_cli." and nothing else. I believe that's because Flutter is installed on a confined environment via Snap and it cannot find the path to load the libraries it needs to run.

Has anyone encountered such an issue? How did you solve it?

Thanks in advance.


Environment

KDE Neon 5.23, based on Ubuntu 20.04 (if relevant)

The result of flutter doctor --verbose:

[✓] Flutter (Channel stable, 2.8.1, on KDE neon User - Plasma 25th Anniversary Edition 5.13.0-25-generic, locale en_US.UTF-8)
    • Flutter version 2.8.1 at /home/erayerdin/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (5 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /home/erayerdin/.sdks/android/
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /snap/android-studio/115/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /snap/android-studio/115/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code
    • VS Code at /snap/code/current
    • Flutter extension version 3.32.0

[✓] Connected device (2 available)
    • 555cd26e (mobile) • 555cd26e • android-arm64  • Android 9 (API 28)
    • Chrome (web)      • chrome   • web-javascript • Google Chrome 97.0.4692.71

• No issues found!


Solution 1:[1]

I have seen this issue and this comment helped me.

You need to do dart pub global activate flutterfire_cli instead of flutter pub global activate flutterfire_cli, add the line to your $HOME/.bashrc file:

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

Then restart the terminal.

Solution 2:[2]

It's easy to solve !

You just have to run it with SUDO like : sudo flutterfire configure.

Only This solution worked for me ! Hope it will work for you !

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eray Erdin
Solution 2 Mohamed Thiam