Gemini CLI in Firebase Studio

Hello everyone,

I wanted to point out a bug/error in the system, but perhaps there’s already a workaround for it. I was just trying to use Gemini CLI via Firebase Studio, but unfortunately, an error occurs during Google authentication, preventing me from proceeding. Here’s the error:

~/web4-sbba-2 (main*) no sandbox (see /docs) gemini-2.5-pro (100% context left)

node:events:502
throw er; // Unhandled ‘error’ event
^

Error: spawn xdg-open ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted ‘error’ event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: ‘ENOENT’,
syscall: ‘spawn xdg-open’,
path: ‘xdg-open’,
spawnargs: [
https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A37281%2Foauth2callback&access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=0081d38940ae6e72584c5f182a0df518110ed5b0cb2cabc9e88a46df8c5706ed&response_type=code&client_id=681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com
]
}

Node.js v20.19.0
npm notice
npm notice New major version of npm available! 10.8.2 → 11.4.2
npm notice Changelog: Release v11.4.2 · npm/cli · GitHub
npm notice To update run: npm install -g npm@11.4.2
npm notice

Sorry for your issue, we discovered a bug preventing Google Auth from working. We now have a workaround you can use until the bug is fully patched.

Try these two step:

  1. Install the updated Gemini CLI (1.12 release) or run

npx https://github.com/google-gemini/gemini-cli

  1. Set this variable required to trigger the right behavior:

export NO_BROWSER="true"

Then run Gemini again in the terminal and it should give you an auth URL to use in an external browser that will login the CLI.

Note: You might have to delete this file first: ~/.gemini/settings.json

2 Likes

Thank you very much, but unfortunately (even after setting up a new project) I still get the same issue:

node:events:502
throw er; // Unhandled ‘error’ event
^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at ServerResponse.end (node:_http_outgoing:1047:15)
at Server. (file:///nix/store/jhxlvvbz1nwi4symphxnnv22z87fnigr-gemini-cli-0.1.9/lib/node_modules/@google/gemini-cli/bundle/gemini.js:57608:15)
at Server.emit (node:events:524:28)
at parserOnIncoming (node:_http_server:1141:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17)
Emitted ‘error’ event on ServerResponse instance at:
at emitErrorNt (node:_http_outgoing:883:9)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: ‘ERR_STREAM_WRITE_AFTER_END’
}

Node.js v20.19.0
project-web4-sbba-2-58105593:~/Project-Web4-SBBA-2{main}$

Damn that is not good, a few things

  1. gemini --version should show 1.12 or higher
  2. Did you set the variable?

If you want to chat in more real time I think you can message me here?

The problem is the version. I always have version 0.1.9 no matter what I try. I have cleared the cache, uninstalled Gemini CLI. I have opened a new workspace, but v0.1.9 always installs. Does this have something to do with the pre-installed version of Gemini CLI?

I cannot install the latest version, even when I run npx https://github.com/google-gemini/gemini-cli#v0.1.12-nightly.250714.b018e2d3

Hi Marc, can you try opening a new terminal and running gemini --version to confirm that you’re getting 0.1.12

Hi Prakhar,
I know that it sounds crazy but I opened a new terminal and no matter what I do I always have 0.1.9. Does it work for you?

Hi Marc,

Yes, it does work for me. I’ve tested this in multiple templates. Here’s a screenshot from my angular workspace

@Marc: can you try running

/home/user/.global_modules/bin/gemini --version

and tell me what you see?

Ok, looks like the issue is stale command hashing.

Need to clear the shell cache first. Try this

$ hash -r

$ gemini --version
0.1.12
1 Like

Thanks, I have attached a video link where I did it on a very fresh blank workspace. I also ran /home/user/.global_modules/bin/gemini --version but forgot it in the video.
The output:

gemini-cli-test-62984493:~/gemini-cli-test$ /home/user/.global_modules/bin/gemini --version
bash: /home/user/.global_modules/bin/gemini: No such file or directory
gemini-cli-test-62984493:~/gemini-cli-test$

The video (expires in 2 days): Watch Screen recording 2025-07-15 9.13.47 PM | Streamable

I’m having the same problem. Any solution?

Update: No idea why, but now I could install the latest version

1 Like

Hi @Marc_Herdina , I’d be curious to hear your feedback on using Gemini CLI in Firebase Studio. How’s the developer experience?

1 Like

It’s so awesome, I’m gonna spend the entire night in the IDE :smiley:

1 Like

When I tried again in the same way, a link appeared in the console and I was able to select my google account through this link. I can now use the Gemini CLI and it offers much more controlled programming. There are features to be added but for now it looks very good even as it is. I hope that Prototyper will reach a controlled structure in this way. After all, whoever can do this can do that. :slight_smile:

Hi,

Sorry I’ve had that many things going on. Could you remind me please what this is for?
Thank you