36

This is my first time when I try to deploy a web application on a remote server. I chose Firebase to deploy my angularJs app. These are the steps provided by them:

  1. npm install -g firebase-tools <---- successfully installed
  2. firebase init <- Here it says that this operation requires login. I proceed to the next step.
  3. firebase login <---- I get the following:

    Error: Cannot run login in non-interactive mode. See login:ci to generate a token for use in non-interactive environments.

I don't know what "see login:ci" means, but I tried:

  1. firebase login:ci <---- I get the following: "Error: Cannot run login:ci in non-interactive mode."

I also wrote a question in their support groups, but no answer yet.

Do you have any idea what should I do?

I'm also opened to try to deploy on other servers. (as longs as they are free)

Darush
  • 11,403
  • 9
  • 62
  • 60
Bogdan Adrian
  • 512
  • 1
  • 4
  • 10
  • What operating system and shell are you using? It seems like the Firebase CLI might be detecting your terminal as a non-interactive shell and activating the mode typically reserved for CI servers. – Michael Bleigh Feb 12 '16 at 18:12
  • Cross-posted here: https://groups.google.com/forum/#!msg/firebase-angular/HAGcB--AG64/6LB5aTrRCgAJ. You can find an answer for your question there. – jwngr Feb 12 '16 at 18:12
  • Two people answered your post to the google group. If their answers weren't clear, follow up there please. – Frank van Puffelen Feb 12 '16 at 18:14
  • 1
    Hey guys. Thank you for answering. I was using the shell from Git (it usually accepts all the commands that the cmd does) and that was the problem. (I switched to powerShell and it worked). – Bogdan Adrian Feb 13 '16 at 07:36
  • On Windows Git bash you can use winpty to make it interactive, see closely related topic here - https://stackoverflow.com/questions/68244224/ng-add-angular-fire-error-cannot-run-login-in-non-interactive-mode/68244350#68244350 – danday74 Jul 04 '21 at 11:52

5 Answers5

102

I received the same error when I installed Firebase and tried to login for the first time.

To fix the error of 'Cannot run login in non-interactive mode', I used the interactive mode instead:

firebase login --interactive

I then granted permission in the browser to successfully login on the CLI.

Note: My platform was Windows 10 and Git Bash, but I'm sure it will work for other platforms too.

Anonsage
  • 8,030
  • 5
  • 48
  • 51
13

I was using the shell from Git (it usually accepts all the commands that the cmd does) and that was the problem. I switched to powerShell and it worked.

Bogdan Adrian
  • 512
  • 1
  • 4
  • 10
1

This problem happens when you already logged in Firebase CLI using Git Bash, you can test with another tool like Command Prompt(CMD on Windows), and in my case show me "Already logged in as xxxxx@gmail.com", So there's no problem.

firebase login

enter image description here

Joel Meza Baca
  • 658
  • 9
  • 13
  • Your answer isn't related to the query. If using Git Bash and the command `firebase login`, it will only lead to the error msg stated in the question. Already logged in will not show up. – Fardeen Khan Jun 03 '20 at 19:29
1

In 2021, you should be using:

ng add @angular/fire

and:

ng deploy

However, on Windows Git bash they don't work. Instead use:

winpty node_modules/.bin/ng.cmd add @angular/fire

winpty node_modules/.bin/ng.cmd deploy

And add these to your package.json scripts - see ng add @angular/fire error Cannot run login in non-interactive mode

danday74
  • 52,471
  • 49
  • 232
  • 283
1

I encountered this using git bash, then I tried the powershell of VS code and it worked. So I think this is a matter of CLI one's using.

Dharman
  • 30,962
  • 25
  • 85
  • 135