Unable to install ForgeCLI

Hi Team,

Need some help, looks like even though Node/npm is on the latest version it is still failing to install the forge CLI when i run sudo npm install -g @forge/cli

npm WARN deprecated json-schema-ref-parser@9.0.9: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated memfs@3.6.0: this will be v4
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/@forge/cli
npm ERR! command failed
npm ERR! command sh -c node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js
npm ERR! /usr/local/lib/node_modules/@forge/cli/node_modules/launchdarkly-js-sdk-common/src/InspectorManager.js:34
npm ERR!   const safeInspectors = inspectors?.map(inspector => SafeInspector(inspector, logger));
npm ERR!                                     ^
npm ERR!
npm ERR! SyntaxError: Unexpected token '.'
npm ERR!     at wrapSafe (internal/modules/cjs/loader.js:915:16)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:963:27)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
npm ERR!     at Module.load (internal/modules/cjs/loader.js:863:32)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
npm ERR!     at Module.require (internal/modules/cjs/loader.js:887:19)
npm ERR!     at require (internal/modules/cjs/helpers.js:74:18)
npm ERR!     at Object.<anonymous> (/usr/local/lib/node_modules/@forge/cli/node_modules/launchdarkly-js-sdk-common/src/index.js:17:46)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:999:30)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Can someone please help

What version of node/NPM are you running? For example:

The Forge CLI requires a fully supported LTS release of Node.js installed; namely, versions 14.x, 16.x, or 18.x.

If you could confirm that you’re on a supported version that would be a good start to eliminate a probable cause.

1 Like

I’m getting the same error with these versions:

$ node --version
v18.17.1

$ npm --version
9.6.7

$ sudo npm i -g @forge/cli
npm WARN deprecated json-schema-ref-parser@9.0.9: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated memfs@3.6.0: this will be v4
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/@forge/cli
npm ERR! command failed
npm ERR! command sh -c node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js
npm ERR! /usr/local/lib/node_modules/@forge/cli/node_modules/launchdarkly-js-sdk-common/src/InspectorManager.js:34
npm ERR!   const safeInspectors = inspectors?.map(inspector => SafeInspector(inspector, logger));
npm ERR!                                     ^
npm ERR!
npm ERR! SyntaxError: Unexpected token '.'
npm ERR!     at wrapSafe (internal/modules/cjs/loader.js:915:16)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:963:27)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
npm ERR!     at Module.load (internal/modules/cjs/loader.js:863:32)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
npm ERR!     at Module.require (internal/modules/cjs/loader.js:887:19)
npm ERR!     at require (internal/modules/cjs/helpers.js:74:18)
npm ERR!     at Object.<anonymous> (/usr/local/lib/node_modules/@forge/cli/node_modules/launchdarkly-js-sdk-common/src/index.js:17:46)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:999:30)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-09-13T20_58_22_149Z-debug-0.log

Same with node 14/npm 6, node 16/npm 8, and node 20/npm 9.

In my case, I install nvm in my terminal.
then i use the command

nvm install node

This command install the version 20 of nodejs.
I must close the cmd and open the wsl again.
Then, i try again to install

sudo npm install - g @forge/cli

and works perfect!.
verify with the command

forge --version
6.18.0