FlutterFire configure CLI requires the official Firebase CLI - flutter

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
+ firebase-tools#11.0.1
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 har-validator#5.1.3: this library is no longer supported
npm WARN deprecated debug#4.1.1: 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 uuid#3.4.0: 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 request#2.88.2: 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.

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.

Remove the previously installed firebase.exe and rely on firebase installed via npm install -g firebase-tools only.
The problem resulted from conflicting installations.

Resolved for me by doing the following after struggling with plenty of errors
Use nvm to install latest node
Change the default directory for packages on windows pc using prefix command. For me I created directory here %appdata%.npm-global and go to this directory then use prefix command to set the default for npm global packages
Ensure this path is in your windows PATH
Install firebase tools npm install -g firebase-tools
Install flutterfire cli dart pub global activate flutterfire_cli
cd to my flutter app directory
From command prompt firebase login
type flutterfire configure
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.

just update your platform to latest version [windows or linux or mac] it worked for me , hope it helps someone

Related

npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist >3.0

I'm using ionic 3 whatsapp clone github project but when i run ionic serve command got this error when i try to install appscripts Error npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
Uninstal Ionic and Cordova:
npm uninstall cordova ionic
Then clean cache:
npm cache clean -f
Then install ionic and cordova again:
npm install -g ionic#3.4.0
npm install -g cordova#7.0.1
Worked for me!
I had the same problem and fixed it by using the following command in the project directory:
npm install
This will install needed packages, so the project can work properly.
See also:
npm deprecated WARN for newly created app #4926
The error itself comes from the package.json file in the browserslist folder in your project.
"deprecated": "Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools."
I'm installing Laravel but get the same error.
I allowed the npm install to go all thr way through and scrolled up. There are some issues present in mine. Will possibly say something like the below.
npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none is
installed. You must install peer dependencies yourself.
npm WARN img-loader#3.0.0 requires a peer of imagemin#^5.0.0 but none
is installed. You must install peer dependencies yourself. npm WARN
optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4
(node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents#1.2.4: wanted
{"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
You can run npm install again if you'd like and this should give you the new errors in a more compact area.
-note: notice the commands below correspond with what is stated after "requires a peer of..."
npm i ajv
npm i imagemin#5.0.0
npm install
Not sure why, but the imagemin wouldn't work unless I specified the version.
At this point I only had one error left
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4
(node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents#1.2.4: wanted
{"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
I believe this has to do with me being on a windows machine. If you get this error just force it. If anyone has a better solution at this point I'd love to hear it.
npm i -f
You could try a reset.
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
I fixed this issue by putting required binaries in the .bin folder under node_modules folder

Eclipse Angular IDE project creation fails and has wrong node version

I'm on a mac. I just installed Angular IDE (eclipse) and when I try to create a new Angular project it fails. I can run the same commands from the terminal and it works. I'm using node 8.9.1 and npm 5.5.1 outside the IDE, but can't find where to tell the plugin to use that version.
Node.js version: v9.1.0
NPM version: 5.5.1
npm install #angular/cli#1.4.9
npm WARN npm npm does not support Node.js v9.1.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node[4666]: ../src/node_zlib.cc:437:static void node::(anonymous namespace)::ZCtx::Init(const FunctionCallbackInfo<v8::Value> &): Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.
1: node::Abort() [/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node]
2: node::(anonymous namespace)::DomainEnter(node::Environment*, v8::Local<v8::Object>) [/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node]
3: node::(anonymous namespace)::ZCtx::Init(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node]
4: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node]
5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node]
6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/bobsmith/.webclipse/nodejs/9.1.0/bin/node]
7: 0x337a5df842fd
/Users/bobsmith/.webclipse/npm/5.5.1/bin/npm: line 14: 4666 Abort trap: 6 node "$basedir/../bin/npm-cli.js" "$#"
First, try to execute outside the IDE the line "npm install #angular/cli#1.4.9", later in the IDE, you need to create the project with the same versions for node, npm, en angular cli that you have installed in your machine.

Ionic App Version

I can't install ionic native App Version.
When I write "ionic cordova plugin add cordova-plugin-app-version" shows next message:
How can I fix it??
λ ionic cordova plugin add cordova-plugin-app-version
> cordova plugin add cordova-plugin-app-version --save
× Running command - failed!
[ERROR] An error occurred while running cordova plugin add cordova-plugin-app-version --save (exit code 1):
Error: Failed to fetch plugin cordova-plugin-app-version via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963229 Error output:
npm ERR! path C:\Users\Xu\Documents\github\rheumaiq_app\node_modules\es6-promise-plugin\package.json
npm ERR! code ELOOP
npm ERR! errno -4067
npm ERR! syscall open
npm ERR! ELOOP: too many symbolic links encountered, open
'C:\Users\Xu\Documents\github\rheumaiq_app\node_modules\es6-promise-plugin\package.json'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Xu\AppData\Roaming\npm-cache\_logs\2017-10-18T14_44_39_797Z-debug.log
UPDATE:
Thanks a lot!!
But the problem is not App Version, is with es6-promise-plugin in node_modules.
package.json
...
"es6-promise-plugin": "file:node_modules/es6-promise-plugin",
...
this folder is empty, I dont know what I have to do.
You have a typo
Here is how it should be
cordova plugin add cordova-plugin-appversion
Your mistake most likely results from the github repo being
https://github.com/Rareloop/cordova-plugin-app-version
But npm version name differs from the git repo name.
You can try cordovas --nofetch option to work around problems like this since cordova 7.0.0:
cordova plugin add cordova-plugin-appversion --nofetch
See the release notes for cordova 7.0.0 here to read more about the --nofetch mode.
The problem is not that it is empty, the problem is that it is a symbolic link that points to itself and therefore does not work. A loop is created.
If you delete the folder node_modules/es6-promise-plugin you will see that it is created again each time you type npm install...
I have seen this efect occurs adding the android platform, when try to do it for the cordova-plugin-x-socialsharing plugin, with the 5.2.1 version.
With the v5.2.0 that does not happen.
You can change your version:
ionic cordova plugin remove cordova-plugin-x-socialsharing --force
ionic cordova plugin add cordova-plugin-x-socialsharing#5.2.0 --force
Or you can change in your package.json the version to use.

Plugin error while building ionic app

during build ionic app, this error is shown:
Error occurred during command execution from a CLI plugin (#ionic/cli-plugin-cordova). Your plugins
may be out of date.
TypeError: env.runcmd is not a function
This error message indicates that the Ionic CLI version is incompatible with other CLI plugins (see https://github.com/ionic-team/ionic/issues/12561).
Please run the following commands in your project directory (where you package.json is):
npm i -g ionic#latest
npm i --save-dev --save-exact ionic#latest
This will install the latest Ionic CLI version (currently 3.7.0) globally and locally. After that the error should no longer occur.
If you have ionic cli version lower than 3.6.0 try to update it. It resolved the issue for me.

npm error while installing ionic dependencies

After cloning the project code from the Repository, I'm trying to install the npm to update the packages and plugins included. The command used is:
npm install
It worked well for previous clones. But now it displays the following error:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm WARN appname# No repository field.
npm WARN appname# No license field.
When I tried to install fsevents using --verbose, it is said that the supported OS is Darwin. But it worked in the previous clone. Why not now?
If your a Windows user:
The fsevents warning isn't a problem. It's an optional dependency and isn't needed for this to work on Windows.
But the error still displaying, in order to fix this.
Open package.json and delete the gulp-watch dependecy
Manualy remove the folder (gulp-watch) from the node_modules fordel
Unload the Project and uploaded again
The error is gone!!!
There's a issue open to fix this in .net core , but this will work untill then.