Unable to login Firebase with cli command - firebase

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

Related

Unable to install 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.

Not compatible with your operating system or architecture: fsevents#2.1.3

I am using ubuntu 18.04.4 LTS
I was trying to learn admin sdk tutorials from google codelab, and was trying to setup the defined project in this
While setting up, the following command gives an error.
npm -g install firebase-tools
and error: "No firebase command found" on command firebase --version
I have tried setting npm settings globally as described here, but nothing works.
Can anyone help me with this, as I am new to firebase admin SDK.
Shouldn't you first install firebase itself?
npm i -g firebase

Firebase - Unable to serve local function after upgrading to 6.9.0

After upgrading firebase-tools from 6.8.0 to 6.9.0 my local function stopped working. I get below error message when calling it from my application:
λ firebase.cmd serve --only functions:upload
+ functions: Using node#12 from host.
+ functions: Emulator running at http://localhost:5001
i functions: Beginning execution of "upload"
! Error: Cannot find module 'package.json'
Require stack:
- C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
at Function.Module._load (internal/modules/cjs/loader.js:526:27)
at Module.require (internal/modules/cjs/loader.js:666:19)
at require (internal/modules/cjs/helpers.js:16:16)
at verifyDeveloperNodeModules (C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:125:32)
at C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:457:26
at Generator.next (<anonymous>)
at C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\MyLocalUsername\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:3:12)
! Your function was killed because it raised an unhandled error.
I have reinstalled node and npm entierly (including deleting %appdata% files), deleted all node_module files and reinstalled everything with npm ci but problem remains.
firebase.cmd is version 6.0.0
How do I continue? I could serve the very same function before upgrading, but now even if trying to downgrade using npm i firebase-tools#6.8.0 problem remains.
The function right now:
const functions = require('firebase-functions');
exports.upload = functions.https.onRequest((req, res) => {
console.log('Upload initiated')
return null;
});
I had the same problem after upgrading from firebase-tools 6.7.2 to 6.9.0
These steps worked for me to roll back to a previous version on Windows 10:
Uninstall the functions-emulator
Uninstall firebase-tools
Remove the functions-emulator config <== This is the step I didn't know about
Re-install a previous version of firebase-tools (6.7.2 or 6.8.0)
Detailed steps:
Switch nodejs version if you have multiple. I removed the functions-emulator and firebase-tools from all versions. Uninstalling needs to be done for each version separately.
nvm use 8.16.0
Uninstall the functions-emulator. More info: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/wiki/Troubleshooting
npm uninstall -g #google-cloud/functions-emulator
Uninstall firebase-tools
npm uninstall -g firebase-tools
Delete the functions-emulator configuration folder found at 'C:\Users\yourusername\.config\configstore#google-cloud\functions-emulator'
Install a previous version of firebase-tools. Versions are listed at https://www.npmjs.com/package/firebase-tools
npm install -g firebase-tools#6.8.0
I believe you may only be able to use the functions-emulator with one nodejs version so if you install it with 8.16.0 then make sure you've switched to that version with '> nvm use 8.16.0' before you start testing cloud functions locally
Login to firebase
firebase login
In your project directory update the functions and admin packages
npm install firebase-functions#latest firebase-admin#latest --save
Start testing locally
firebase functions:shell
Or use
firebase serve
Note: Calling the functions-emulator directly with 'firebase emulators:start' won't work.
Follow this issue on github for updates: https://github.com/firebase/firebase-tools/issues/1258

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 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