Unable to install Firebase - firebase

I am unable to install firebase tool.
> C:\Users\Mohit Saini>npm i -g firebase-tools
> npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
> npm ERR! Unexpected end of JSON input while parsing near '...ePY2w==","shasum":"89'

firstly run npm cache clean --force to clear previous caches
after that run npm cache verify which will bring 0 bytes indicating all cache was cleared.
lastly run npm install -g firebase-tools
note: running the clean --force command will deletes all data from your cache folder.

When I search for the error message, this Github issue shows up: https://github.com/firebase/firebase-tools/issues/2215, which seems to indicate the problem can be fixed by running:
npm cache verify
If you get problems installing the CLI, and are not familiar enough with the environment to fix them, I'd recommend installing the standalone binary version of the Firebase CLI instead.

Related

Unable to login Firebase with cli command

I'm trying to login to my Firebase account with cli command firebase login. I believe it should open browser and prompt me to login with my google account, but that doesn't seem to happen.
Instead, it's asking me to enter my email and password in the terminal. Once I enter my credentials, it throws the following error:
/usr/lib/node_modules/firebase-cli/node_modules/source-map-support/source-map-support.js:223
return '\n at ' + wrapCallSite(frame);
^ TypeError: CallSite method toString expects CallSite as receiver
How do I fix this as I want to deploy my app to Firebase?
I've had the same issue.
You're probably using firebase-cli instead of firebase-tools.
https://firebase.google.com/docs/cli#update-cli
firebase-cli has been deprecated years ago.
#mikeonline did you ever installed the Firebase tools/cli before on
your machine (before we launched v3 at Google IO) basically did you
have v2.2 previously installed perhaps?
firebase-cli has been deprecated a year ago and only installs v1. NPM
should have printed this message"
npm WARN deprecated firebase-cli#1.2.0: Use firebase-tools instead.
Both v2 and v3 can be installed with npm install -g firebase-tools but
by default the latest version (3.0.0) gets installed.
https://github.com/firebase/codelab-friendlychat-web/issues/22#issuecomment-220695413
Execute the below command
npm uninstall firebase-cli
npm uninstall firebase-tools
npm install -g firebase-tools --force

Cannot upgrade or remove firebase from system

I cannot, as the title suggests, upgrade or in any way remove the current version of firebase off my system and I don't understand why. I installed it using the firebase commands prompted when you first start a project, something in line with npm install -g firebase-tools. After I've installed other packages to go along with it and I've upgraded the packages accordingly.
Now I want to remove the package I just do not understand how to do it. I've run
npm uninstall -g firebase-tools
npm uninstall -g firebase-admin
npm uninstall -g firebase-functions
npm uninstall -g firebase*
...and many other variations. After a while of trying I just figured I'll check what packages may still be left.
npm ls | grep firebase
Shows no firebase packages are still installed, however, running any firebase command will still work perfectly. Running firebase --version I get 3.15.4. I've also, just as a Hail Mary, tried running apt remove --purge firebase*
Further digging I figured that maybe the npm ls command was off, so I tried reinstalling all firebase packages. I ran it again and there they were, however* firebase was now at version 4.12.1. Running firebase --version still produce 3.15.4.
I'm really lost at this point. All help articles relating to uninstalling firebase leads to either how to delete projects or databases or to npm's how to uninstall a package website.
Sincerely.
You can't delete it, because you need to remove entire folder. This worked for me when I ran into the same problem:
which firebase
This locates the folder where firebase is (in Mac case it's /usr/local/bin/firebase) and then you do:
rm /usr/local/bin/firebase
Now do firebase -V and you'll get Command firebase not found. And now you can install back firebase with the real latest actual version:
npm i -g firebase-tools#latest
However, if you run firebase it will still give you Command firebase not found for what you can do this:
alias firebase="`npm config get prefix`/bin/firebase"
Worked for me with almost exactly the same problem.
Hope this helps you too!

Firebase config variables are not available error with deploying functions

When I am deploying Firebase functions without
admin.initializeApp(functions.config().firebase);
Firebase logs
Error: The default Firebase app does not exist. Make sure you call
initializeApp() before using any of the Firebase services.
But if I add that line I get error on deploy.
>firebase deploy --only functions
Error:
Error: Error occurred while parsing your function triggers. Please
ensure you have the latest firebase-functions SDK by running "npm i
--save firebase-functions#latest" inside your functions folder.
Error: Firebase config variables are not available. Please use the
latest version of the Firebase CLI to deploy this function.
I already did npm i --save firebase-functions#latest which haven't done anything. I am stuck and can't do anything right now because of this... I am down for any reinstalls if they could help just tell me some steps or hints and I would seek for the rest.
NPM and NodeJS versions are:
node -v
v8.9.1
npm -v
5.6.0
Edit. Installation with admin rights:
npm i --save firebase-functions#latest
npm WARN firebase-functions#0.8.1 requires a peer of firebase-admin#~5.8.1 but none is installed. You must install peer dependencies yourself.
npm ERR! path C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\abbrev' -> 'C:\Users\Telion\firebaseApps\project-name\functions\node_modules\firebase-admin\node_modules\grpc\node_modules\.abbrev.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
It actually appeared I was on npm version 5.5.1 but even after the update to 5.6.0 I got the exact same error.
There was a breaking change introduced in firebase-tools#3.17.x which requires your project to upgrade firebase-functions to the latest version.
However, firebase-functions#latest also requires firebase-admin#latest (at the time of writing this answer firebase-admin#5.11.0. Once all packages are upgraded, this problem should be solved.
Another alternative is to downgrade your global firebase-tools to 3.16.0, which lets you use older firebase-functions and firebase-admin packages.
I ran into the same issue in Ubuntu and this is how i solved it
Install firebase using : sudo npm install -g firebase-tools
Also make sure you launch using admin privileges e.g to login
sudo firebase login
You also need to update the node to at least 8.15.x. That detail is shown in the message.
Once I intalled that I had to do a firebase login command and after that you can run the firebase init hosting
Previously I was getting the error on firebase init hosting but after that node update, it went away.
Hope it helps.
For me, it worked for firebase-tools6.9.2.
The firebase-tools3.16.0 is completely depricated.

Error when trying to install firebase with NPM

I am trying to (re)install Firebase, however, when I run sudo npm install -g firebase-tools the following error shows up:
I have no idea what is wrong, it used to work well a few month ago.
You try running
npm cache clean
and then trying to install again.
If the error is not lost try below
Have you tried installing homebridge with the --unsafe-perm option?
sudo npm install -g --unsafe-perm homebridge
If npm detects it is running as root it drops to a non-privileged user which then doesn't have permissions to write to /root/.node-gyp. The --unsafe-perm option stops it from changing user.
nvm doesn't have this problem when not using sudo because it stores everything under the current users' home directory.

firebase version is not updating through <npm install -g firebase-tools>

i am windows user and trying to update firebase version using
npm install -g firebase-tools but when i run firebase --version
it shows the same version.
I also run npm uninstall firebase --save and check firebase --version it shows same.
what should i do to update my firebase version?
npm update -g firebase-tools
or
npm install -g firebase-tools#3.12.0 to install a specific version
And make sure to restart your terminal/IDE otherwise, it won't take effect.
Have you tried npm update -g firebase-tools? This worked for me.
These days if you're on an older version, and you check the version of firebase-tools, by running:
firebase -V
along with the version of firebase-tools that you're on, it also gives you a messages, something like this:
So you can basically run npm i -g firebase-tools to update the version of your firebase-tools installation to the latest version.
Hope this helps :)
For other like me stumbling in with a weird version mismatch:
When I did firebase -V in my terminal I would get a different version (5.1.1) than when I ran firebase through a npm run script (3.19.3)
The problem was that I had previously installed firebase locally into that project. In other words, I was getting the global version in the terminal, but npm was using the node_modules version
To confirm this, I added a simple test called test-foo to my package.json (firebase -V && which firebase) and ran it:
kuzyn(λ)matebox‡ npm run test-foo
kuzyn-project#1.1.0 test-foo /home/kuzyn/code/kuzyn-project/firebase
firebase -V && which firebase
3.19.3
/home/kuzyn/code/kuzyn-project/firebase/node_modules/.bin/firebase
Then I removed the (uneeded in my case) local firebase package from the package.json and from node_modules
Try the 2 steps bellow
1. yarn/npm cache clean
2. npm install -g firebase firebase-tools or yarn add -g firebase firebase-tools
in a new terminal, firebse --version
works for me
it works to me...
standalone binary: Download the new version, then replace it on your system
if you are using the standalone.Download the new version
In my case I was using an old node version (v10) and had to switch to a newer one (v12). After that I ran npm install -g firebase-tools again and it was updated to the latest version.
You can check the current node version by running node -v. And I use nvm to switch to a different node version.
That might happen in case you've installed the firebase-cli using a so called automatic install script.
Try to call curl -sL https://firebase.tools | upgrade=true bash as described in the official documentation

Resources