[BUG] [WINDOWS] npm scripts fail with "/d: No such file or directory" when run by Claude
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
- 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"
}
}
- Create .env file:
NODE_ENV=test
- Create test.ts file:
console.log("Hello from TypeScript!");
- Run
npm install
- Test directly in Git Bash terminal:
npm run test-bug
- 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)
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗