flutterfire configure fails with FirebaseCommandException from the Firebase CLI
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.Short answer
flutterfire configure runs the Firebase CLI underneath, so any CLI failure surfaces as FirebaseCommandException. Run the same CLI command by hand to see the real message. The usual causes are no login or an expired one, the CLI missing or too old, and a Node.js version below what the CLI requires.
Fix it fast
1Find out which cause you have
List your Firebase projects directly. This is a command the CLI runs for you, and its own error text is the real cause.
firebase projects:list2Match what you see, then jump to its fix
- 1
The CLI says you must authenticate, or projects:list prints no projects you expectNot logged in, or the login expiredFix - 2
firebase: command not found, or an old CLI fails on a new project featureThe Firebase CLI is not installed, or it is outdatedFix - 3
npm or the CLI prints an engine or syntax errorNode.js is older than the CLI needsFix - 4
flutterfire: command not foundThe FlutterFire CLI is not activatedFix
- 1
What does the error look like?
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
Cause 1 of 4
Not logged in, or the login expired
1Check
See which Google accounts the CLI has.
firebase login:list2Fix
Log in again with the account that owns the project, and switch to it if several are listed. On a remote machine without localhost access add --no-localhost.
firebase login
firebase login:use you@example.com3Verify
projects:list shows the projects of that account, then retry the configure.
firebase projects:list
flutterfire configureConfirmed by firebase.google.com
Cause 2 of 4
The Firebase CLI is not installed, or it is outdated
1Check
Check that the firebase command exists on PATH.
which firebase2Fix
Install or update it with npm, or with the install script on macOS and Linux.
npm install -g firebase-tools3Verify
The command resolves and lists projects.
firebase projects:listConfirmed by firebase.google.com
Cause 3 of 4
Node.js is older than the CLI needs
1Check
The npm install of the CLI requires Node.js 18.0.0 or later.
node --version2Fix
Upgrade Node.js, then reinstall the CLI.
npm install -g firebase-tools3Verify
node reports 18 or later and the CLI runs.
node --version
firebase projects:listConfirmed by firebase.google.com
Cause 4 of 4
The FlutterFire CLI is not activated
1Check
Check that Dart's global bin folder is on PATH and flutterfire resolves.
which flutterfire2Fix
Activate the tool as the Flutter setup guide shows, then run configure from the project folder.
dart pub global activate flutterfire_cli
flutterfire configure3Verify
configure lists your projects and writes lib/firebase_options.dart.
ls lib/firebase_options.dartConfirmed by firebase.google.com
How do I stop it coming back?
- Run firebase login:list before a setup session, especially on a machine you have not used for weeks.
- Keep Node.js and firebase-tools updated together.
- In CI, use a service account through GOOGLE_APPLICATION_CREDENTIALS instead of an interactive login.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Mobile apps
flutterfire configure fails in the terminal with command not found
flutterfire: command not found
FlutterFire CLI is a Dart tool installed separately.
2 causes, each with a fixMobile apps
FCM rejects the message with INVALID_ARGUMENT
HTTP 400 from fcm.googleapis.com/v1/projects/PROJECT_ID/messages:send
INVALID_ARGUMENT is HTTP 400: FCM did not accept the request parameters.
3 causes, each with a fixMobile apps
Push sending broke because the server still uses the legacy FCM API
Console notice that the legacy Firebase Cloud Messaging API is deprecated
Sends that still use the legacy FCM API (a server key in the Authorization header) or old Admin SDK methods need to move to the HTTP v1 API.
3 causes, each with a fixMobile apps
FCM says the token is not found when you send a push
UNREGISTERED
The FCM HTTP v1 API returns UNREGISTERED with HTTP 404 when the app instance behind a token is gone: the app was uninstalled, the token expired, the client unregistered, or the token you pass is empty.
2 causes, each with a fixMobile apps
firebase projects:create or flutterfire configure says 'Failed to create project'
Error: Failed to create project. See firebase-debug.log for more info.
A Firebase project is a Google Cloud project, so creation fails on the same rules: the ID must be 6 to 30 lowercase characters and never used before (deleted projects count), your account must be allowed to create projects, and you must be under the project limit.
3 causes, each with a fixMobile apps
The iOS push arrives from FCM but plays no sound
A custom sound name in the payload is ignored and nothing plays
iOS plays a sound for a remote notification only when the aps payload has a sound key and the app is allowed to play sounds.
3 causes, each with a fix