Skip to content

[Windows] Error: spawn gemini ENOENT when using ask-gemini tool #18

@GBdeMiranda

Description

@GBdeMiranda

Description
When using gemini-mcp-tool on Windows, the tool fails with Error: spawn gemini ENOENT. The issue occurs because the spawnCommand function in src/utils/commandExecutor.ts doesn't account for Windows-specific execution requirements.

To Reproduce
Steps to reproduce:

  1. Install on Windows: npm install -g gemini-mcp-tool
  2. Send a request:
  3. Observe error: Error: spawn gemini ENOENT

Expected Behavior:
Successful execution of Gemini commands on Windows.

Actual Behavior:
Failure with ENOENT error due to:

  1. Missing .cmd extension handling
  2. Incorrect PATH resolution
  3. Lack of shell execution

Problem Location:
src/utils/commandExecutor.ts:

const child = spawn(command, args, { stdio: 'pipe' }); // Windows-incompatible

Proposed Solution:
Modify to support Windows:

import * as os from 'os';

// ...

const child = spawn(command, args, {
  stdio: 'pipe',
  shell: os.platform() === 'win32', // Enable shell on Windows
  windowsHide: true // Hide CMD window
});

Environment:

  • Node version: v22.12.0
  • OS: Windows 11
  • MCP client: Claude Desktop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions