Reputation: 153
I'm having a problem to configure Flutter Fire to my project. I installed using npm install -g firebase-tools --force and then I tried > dart pub global activate flutterfire_cli but i still have a problem with CLI. I can login and see the version but i can't run flutterfire configure
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.
After read all the topics on stackoverflow and on internet i can't solve my problem, any ideas? Running npm install -g firebase-tools I got this:
> npm install -g firebase-tools
C:\Users\loveh\.cache\firebase\tools\firebase -> C:\Users\loveh\.cache\firebase\tools\node_modules\firebase-tools\lib\bin\firebase.js
+ [email protected]
updated 1 package in 11.091s
Now it's appearing this error:
⠋ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
#
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:114:7)
<asynchronous suspension>
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:264:24)
<asynchronous suspension>
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:351:37)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10 main (file:///C:/Users/loveh/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.2+2/bin/flutterfire.dart:57:5)
<asynchronous suspension>
News
npm install -g firebase-tools
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/d
ebug/issues/797)
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
changed 691 packages, and audited 692 packages in 36s
38 packages are looking for funding
run `npm fund` for details
25 vulnerabilities (15 moderate, 10 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Upvotes: 6
Views: 13099
Reputation: 3
If you are trying in bash or other terminal then it will not know what is flutterfire . Try this command "flutterfire configure" in command prompt.
Upvotes: 0
Reputation: 11
It's JDK Path Problem you need to add Java JDK do the following seps:
C:\Program Files\Java\jdk-16.0.2\bin
.flutterfire configur
command.
it work with me.Upvotes: 1
Reputation: 71
If you installed firebase-tools while your IDE was open, then you'd get that error if you run flutterfire configure
afterwards. My guess is that environment variables got changed.
Solutions (any would work):
flutterfire configure
command againUpvotes: 0
Reputation: 3067
Solution 2023 for Windows 11
firebase-tool-instant-win.exe
) to "Downloads" folderYou should see an output like below:
In Firebase CLI use cd
(change directory) commands to get to your flutter project folder, same as you would have done in Windows cmd.
Still in Firebase CLI run the following command:
dart pub global activate flutterfire_cli
If the output says that C:\Users\[USER]\AppData\Local\Pub\Cache\bin
is not on your path, you will have to add this to the path, then restart your pc. To add this to your path, search Windows Control Panel for "path"
Don't forget to restart!
flutterfire configure
Upvotes: 2
Reputation: 11
For me it is solved by running command in cmd itself not in internal terminal of Android Studio.
but
Upvotes: 0
Reputation: 1
just update your platform to latest version [windows or linux or mac] it worked for me , hope it helps someone
Upvotes: 0
Reputation: 3157
Resolved for me by doing the following after struggling with plenty of errors
Ensure you do not have the windows exe downloaded as it may conflict when you run firebase/flutterfire. For me, the trick was to ensure I used nvm to install npm, setting default directory install for npm global to something other than default. I believe this was a permission issue.
Upvotes: 2
Reputation: 555
If you get the FormatException: Unexpected character (at character 1)
error, look if you have a firebase.exe file in your flutter main folder. This was my problem. After deleting the file, flutterfire configure
works with no problem.
Clarification: I have added the firebase-cli binary (firebase-tools-instant-win.exe) to the main folder of my flutter project and renamed it to firebase.exe because of previuos bug fix attempts. If you don't have done that, there should be no firebase binary in your flutter main folder.
Upvotes: 2
Reputation: 2825
Remove the previously installed firebase.exe
and rely on firebase
installed via npm install -g firebase-tools
only.
The problem resulted from conflicting installations.
Upvotes: 3