[BUG] bash command failing with no output when run from claude but works from command line
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
In two different cases, claude code tries to run a command using Bash() and gets (no output) when it should, or the command just doesn't run.
One was running thor (ruby) build. The other is with npm build.
This is a regression. The same exact procedures used to work a couple weeks ago.
Here's the command that is being run by Bash() from claude. If I open a git bash window and paste it directly, it works fine. If I run it from a claude code cli session (started from a git bash session), then it doesn't work.cd "D:/kd/git/claude-tools/my-mcp-server" && rm -rf dist && npm run build && ls dist/index.js
Note that it seems to be a problem with the npm bash script, not the npm.cmd file. If claude runs cmd //c npm.cmd, then it works.
What Should Happen?
It should run the npm build and get output as well as actually create files in the dist directory.
Error Messages/Logs
● Bash(cd "D:/kd/git/claude-tools/my-mcp-server" && rm -rf dist && npm run build && ls dist/index.js) timeout: 1m 0s
⎿ Error: Exit code 2
ls: cannot access 'dist/index.js': No such file or directory
If the ls at the end is not run, then you get "(no output)" from the npm command.
Steps to Reproduce
Try to create an mcp server that uses npm/tsc.
At some point, claude will try to build and look for syntax errors.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
not sure
Claude Code Version
2.1.20
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗