gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

gemini-cli/node_modules/string-width/index.js:16 "Invalid regular expression flags" after a fresh install

Open mogoreanu opened this issue 1 month ago • 3 comments

What happened?

Invocation errors immediately after installation on Debian 12.12

uname -a
Linux mogo-p920 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64 GNU/Linux

There were a bunch of warnings during installation:

npm install -g @google/gemini-cli
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@google/[email protected]',
npm WARN EBADENGINE   required: { node: '>=20' },
npm WARN EBADENGINE   current: { node: 'v18.20.4', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@google/[email protected]',
npm WARN EBADENGINE   required: { node: '>=20' },
npm WARN EBADENGINE   current: { node: 'v18.20.4', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@google/[email protected]',
npm WARN EBADENGINE   required: { node: '>=20.0.0' },
npm WARN EBADENGINE   current: { node: 'v18.20.4', npm: '9.2.0' }
npm WARN EBADENGINE }
...
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@isaacs/[email protected]',
npm WARN EBADENGINE   required: { node: '20 || >=22' },
npm WARN EBADENGINE   current: { node: 'v18.20.4', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '20 || >=22' },
npm WARN EBADENGINE   current: { node: 'v18.20.4', npm: '9.2.0' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: Use your platform's native DOMException instead

Error:

a2 ~$ gemini 
file:///usr/local/lib/node_modules/@google/gemini-cli/node_modules/string-width/index.js:16
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v;
                              ^

SyntaxError: Invalid regular expression flags
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:299:14)

Node.js v18.20.4

What did you expect to happen?

Authentication steps

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here

Login information

No response

Anything else we need to know?

No response

mogoreanu avatar Dec 08 '25 20:12 mogoreanu

Found possible duplicate issues:

  • #14173
  • #13427
  • #3872

If you believe this is not a duplicate, please remove the status/possible-duplicate label.

gemini-cli[bot] avatar Dec 08 '25 20:12 gemini-cli[bot]

Can you try updating to node version 20? Looks like you're on 18

skeshive avatar Dec 08 '25 21:12 skeshive

Can you try updating to node version 20? Looks like you're on 18

@skeshive Worked with node v25.2.1

Should we add a verification for the node version at the beginning of the application execution? v18 was the default debian 12 version and getting a newer version required extra steps that are not obvious for someone who's not into nodejs stuff.

mogoreanu avatar Dec 09 '25 03:12 mogoreanu

Hmmm IMO the NPM warning should be sufficient. If you feel strongly about the warning, feel free to open a PR for it and add me as a reviewer.

skeshive avatar Dec 09 '25 14:12 skeshive

This issue is still exists on v0.20.0 Fresh Install, Why closed? Please Reopen issue

steveepreston avatar Dec 12 '25 10:12 steveepreston

I am on Ubuntu 24. Bumped up node version to 20 using instructions here : https://joshtronic.com/2023/04/23/how-to-install-nodejs-20-on-ubuntu-2004-lts

I no longer see this issue.

deborshisaha avatar Dec 14 '25 21:12 deborshisaha

Upgrading Notejs version solved. but the error is cofusing. please provide a correct alert

steveepreston avatar Dec 15 '25 16:12 steveepreston