[BUG] [WINDOWS] npm scripts fail with "/d: No such file or directory" when run by Claude

Resolved 💬 5 comments Opened Jul 22, 2025 by shorn Closed Dec 13, 2025

Note: This bug report was generated by Claude itself based on observed
behavior. Please verify the reproduction steps and technical details.

Environment

  • Platform: [x] Anthropic API
  • Claude CLI version: 1.0.57 (Claude Code)
  • Operating System: Windows 10 (MINGW64_NT-10.0-19045)
  • Terminal: Git Bash (MINGW64)

Bug Description

npm scripts with nested Node.js wrapper scripts fail when executed by Claude but
work correctly when run directly in the same terminal. Error:
/usr/bin/bash: /d: No such file or directory. Occurs with dotenv + ts-node
and similar combinations.

Steps to Reproduce

  1. Create a new project with package.json:
{
  "name": "claude-code-bug-test",
  "dependencies": {
    "dotenv-cli": "^7.4.2",
    "ts-node": "^10.9.1",
    "typescript": "^5.2.2"
  },
  "scripts": {
    "test-bug": "dotenv -e .env -- ts-node test.ts"
  }
}
  1. Create .env file:
NODE_ENV=test
  1. Create test.ts file:
console.log("Hello from TypeScript!");
  1. Run npm install
  1. Test directly in Git Bash terminal:
npm run test-bug
  1. Ask Claude to run the same command (e.g., "run npm run test-bug")

Expected Behavior

Step 5 should output: Hello from TypeScript!
Step 6 should produce the same output.

Actual Behavior

Step 5 works correctly and outputs: Hello from TypeScript!
Step 6 fails with: /usr/bin/bash: /d: No such file or directory

Workaround

Create alternative npm scripts that call JavaScript binaries directly:

{
  "scripts": {
    "my-script": "dotenv -e .env -- ts-node src/script.ts",
    "my-script-claude": "node node_modules/dotenv-cli/cli.js -e .env -- node node_modules/ts-node/dist/bin.js src/script.ts"
  }
}

Additional Context

Root Cause: Nested MINGW64 wrapper scripts with cygpath -w conversions
generate a spurious /d parameter in Claude's execution context.

Impact: Affects dotenv + ts-node and similar nested wrapper combinations.
Prevents Claude from executing standard Node.js workflows that work fine in
native Git Bash.

Environment: Node.js v22.17.1, npm 10.9.2, /usr/bin/bash (MINGW64)

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗