Cloudflared forge tunnel not working

I have upgraded to latest forge cli version 10.2.0 and when I am trying to run the command forge tunnel it is giving me the following error in the terminal:

Error: spawn /usr/local/lib/node_modules/@forge/cli/node_modules/cloudflared/bin/cloudflared ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /usr/local/lib/node_modules/@forge/cli/node_modules/cloudflared/bin/cloudflared',
  path: '/usr/local/lib/node_modules/@forge/cli/node_modules/cloudflared/bin/cloudflared',
  spawnargs: [
    'tunnel',
    'run',
    '--token',
    '<token-here>',
    '--url',
    'localhost:50709',
    '--protocol',
    'http2',
    '3d6c5e8c-34a7-45e0-8ddb-9488617441de'
  ]
}

Kindly help in resolving this issue.

Hi @TejasviGarg, the error that you are getting back (ENOENT) suggests that the Cloudflare binary included in the Forge CLI package is missing. I would suggest reinstalling the Forge CLI as a potential solution.

1 Like

I resolved this issue through:

  1. delete cli folder /usr/local/lib/node_modules/@forge/cli in my Macbook
  2. unset development
  3. npm install -g @forge/cli
  4. forge tunnel