[BUG] Bash tool doesn't capture stdout from shell script files on Windows

Resolved 💬 75 comments Opened Jan 16, 2026 by spragginsdesigns Closed Apr 30, 2026
💡 Likely answer: A maintainer (km-anthropic, contributor) responded on this thread — see the highlighted reply below.

Description

On Windows, the Bash tool does not capture stdout from shell script files. This affects all shell scripts, including npm CLI shims, custom scripts, and any executable shell script.

Environment

  • OS: Windows 11 (10.0.26200)
  • Node: v22.21.0
  • Claude Code: Started occurring around v2.1.x
  • Shell: Git Bash (MINGW64)

Reproduction Steps

# Create a simple shell script
cat > /tmp/test.sh << EOF
#!/bin/sh
echo "hello from script"
EOF
chmod +x /tmp/test.sh

# These produce NO output:
/tmp/test.sh
sh /tmp/test.sh
bash /tmp/test.sh

# But these WORK:
sh -c "echo hello"
echo "echo hello" | sh
bash -c "echo hello"

Expected Behavior

Shell script files should have their stdout captured and returned, same as inline commands.

Actual Behavior

| Command Type | Output Captured? |
|--------------|------------------|
| sh -c "echo hello" | ✅ Yes |
| bash -c "echo hello" | ✅ Yes |
| echo "cmd" \| sh | ✅ Yes |
| node /path/to/script.js | ✅ Yes |
| /path/to/script.sh | ❌ No |
| sh /path/to/script.sh | ❌ No |
| bash /path/to/script.sh | ❌ No |

Exit code is 0 (success), but stdout is empty.

Impact

This breaks all npm CLI tools on Windows because npm creates shell shims like:

#!/bin/sh
basedir=$(dirname ...)
exec node "$basedir/node_modules/pkg/dist/main.js" "$@"

When Claude Code runs linearis, prettier, eslint, or any npm-installed CLI, no output is returned.

Workaround

Call node directly, bypassing the shell shim:

# Instead of: linearis issues read LC-123
node /c/Users/Owner/AppData/Roaming/npm/node_modules/linearis/dist/main.js issues read LC-123

Or use PowerShell wrapper:

powershell.exe -Command "linearis issues read LC-123"

Possibly Related Changelog Entries

  • v2.1.2: "Changed large bash command outputs to be saved to disk instead of truncated"
  • v2.1.0: "Added unified Ctrl+B backgrounding for both bash commands and agents"

These changes may have affected how stdout is captured from shell script file execution vs inline commands.

View original on GitHub ↗

75 Comments

spragginsdesigns · 6 months ago

Additional Context from Changelog

After reviewing the changelog, these changes may be related:

v2.1.2:

"Changed large bash command outputs to be saved to disk instead of truncated, allowing Claude to read the full content"

This changed how bash output is captured—from in-memory to disk-based storage.

v2.1.0:

"Added unified Ctrl+B backgrounding for both bash commands and agents"

This restructured the Bash tool's execution model for background task handling.

Hypothesis: The exec-substituted process's stdout may not be properly piped to the disk-based capture mechanism, or the exec'd process is being incorrectly detected/handled as a background task.

The npm shim pattern is:

exec node "$basedir/node_modules/pkg/dist/main.js" "$@"

When exec replaces the shell process with node, the new process's stdout might not be connected to whatever file/pipe Claude Code is reading from.

spragginsdesigns · 6 months ago

Root Cause Identified

After more debugging, the issue is broader than npm shims - it affects all shell script files on Windows.

What Works

  • sh -c "echo hello" - Output captured
  • echo "echo hello" | sh - Output captured
  • bash -c "echo hello" - Output captured
  • node /path/to/main.js - Output captured

What Does NOT Work

  • /tmp/script.sh - No output
  • sh /tmp/script.sh - No output
  • bash /tmp/script.sh - No output
  • /c/path/to/npm/shim - No output (because it is a shell script file)

Test Case

cat > /tmp/test.sh << EOF
#!/bin/sh
echo "hello"
EOF
chmod +x /tmp/test.sh
/tmp/test.sh          # No output
bash /tmp/test.sh     # No output

Conclusion

The bug is NOT about exec in npm shims - it is that stdout from shell script file execution is not being captured on Windows. This affects all shell scripts, including npm shims, custom scripts, etc.

The sh -c and pipe-to-sh workarounds work because they do not execute a script file.

tmaarcxs · 6 months ago

i have the same problem, 2.1.9

amdcq · 6 months ago

Can confirm this not working. The stable version v2.1.2 does not appear to have this issue.

<img width="1227" height="917" alt="Image" src="https://github.com/user-attachments/assets/2d4ef9e8-6bb1-4804-9c0d-2d141a6d9d2f" />

<img width="1171" height="801" alt="Image" src="https://github.com/user-attachments/assets/ff883a8b-ed2d-4ebf-908f-6ce2d82d5557" />

<img width="1226" height="317" alt="Image" src="https://github.com/user-attachments/assets/6f6fa585-4448-4535-9b8f-df7d4bbbebf1" />

<img width="912" height="113" alt="Image" src="https://github.com/user-attachments/assets/605d2aee-b397-45f7-833a-54655ce7fac4" />

rythazhur · 6 months ago

This also is broken for me as of updating today.

intellia1 · 6 months ago

I’m also hitting this issue starting today after updating to v2.1.9 on Windows 11.

jklazinga · 6 months ago

Also encountering this issue starting today. Workaround for now, at least for npm/npx, is to append .cmd (e.g., 'npm.cmd run lint' outputs fine).

amdcq · 6 months ago

Confirming this still happening on v2.1.11

amdcq · 6 months ago

This seems like it will take some time to get fixed. In the meantime here is a workaround for windows users.

Workaround

(Automatic and simple)
  1. Downgrade to v2.1.2 via /config to stable.
(Manual)
  1. Upgrade to a slightly newer specific version that does not have this issue.

Add to .claude/settings.json Or project's .claude/settings.local.json

"autoUpdatesChannel": "stable",
"minimumVersion": "2.1.7"

Via Powershell:

& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) 2.1.7

Via Windows CMD:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd 2.1.7 && del install.cmd

Via WSL / Linux:

curl -fsSL https://claude.ai/install.sh | bash -s 2.1.7
karl-keysingularity · 6 months ago

I'm on windows and 2.1.7 seems to still work. 2.1.8 breaks.

eth0real · 6 months ago

I have this issue as well v2.1.12, running in CLI on windows

eth0real · 6 months ago
Also encountering this issue starting today. Workaround for now, at least for npm/npx, is to append .cmd (e.g., 'npm.cmd run lint' outputs fine).

confirmed this workaround works

❯ there seems to be a claude code bug.  if you run `npm run lint` there should be no output.  please verify.  then try `npm.cmd run lint`

● Bash(npm run lint)
  ⎿  (No content)

● Bash(npm.cmd run lint)
  ⎿  > checkademic@1.4.1 lint
     > npm run lint --workspace=backend && npm run lint --workspace=frontend
     … +7 lines (ctrl+o to expand)

● Confirmed. There's a difference in behavior on Windows:

  - npm run lint: No output captured (shows "Tool ran without output or errors")
  - npm.cmd run lint: Shows the actual output from ESLint

  Both commands succeed (lint passes with no warnings), but npm without the .cmd extension doesn't have its stdout captured properly. This appears to be a
  Windows-specific issue with how the Bash tool handles npm - on Windows, npm is a shell wrapper while npm.cmd is the actual executable.

❯ the `ssh checkademic-test "docker ps"` has a simaliar issue, woud ssh.cmd work?

● Bash(ssh checkademic-test "docker ps")
  ⎿  (No content)

● Bash(ssh.exe checkademic-test "docker ps")
  ⎿ CONTAINER ID   IMAGE                      COMMAND                  CREATED          STATUS                    PORTS
                                   NAMES
    e2e0abf2e95d   checkademic-nginx:latest   "/docker-entrypoint.…"   39 minutes ago   Up 39 minutes (healthy)   0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:443
    … +9 lines (ctrl+o to expand)


● Same issue, same fix:

  - ssh checkademic-test "docker ps": No output captured
  - ssh.exe checkademic-test "docker ps": Works correctly, shows all containers

  On Windows, using the explicit extension (.cmd for npm, .exe for ssh) bypasses whatever wrapper is causing stdout to not be captured. This is a consistent bug in
  Claude Code's Bash tool on Windows when the command doesn't have an explicit extension.
Erodenn · 5 months ago

Closed #18882 and adding findings here:

Additional Findings: Shebang-Specific Behavior

I've done testing on this issue and can confirm some additional details:

Narrowed Root Cause: Shebang Line Specifically

Within Claude Code, I found that the shebang line itself is the trigger:

  • Script WITHOUT shebang: echo 'echo test' > t.sh && bash t.sh → Output captured
  • Script WITH shebang: echo -e '#!/bin/bash\necho test' > t.sh && bash t.sh → No output

Same script content, only difference is the shebang. Exit code is 0 in both cases.

Terminal Verification (Bug is 100% Claude Code Specific)

Ran identical tests in native Git Bash and PowerShell → Git Bash. All tests pass outside Claude Code:

  • bash /tmp/script-with-shebang.sh → works in terminal, no output in Claude Code
  • bash -c 'bash /tmp/script-with-shebang.sh' → works in terminal, no output in Claude Code
  • bash -l -c 'bash /tmp/script.sh' < /dev/null → works in terminal, no output in Claude Code
  • "/c/Program Files/nodejs/npm" --version → works in terminal (11.6.2), no output in Claude Code

Sourcing Workaround Confirms Script Validity

Running source "/c/Program Files/nodejs/npm" --version outputs 11.6.2 correctly.

When sourced (runs in current shell), output is captured. When executed as subprocess (bash interprets shebang, spawns
child), output is lost.

Conclusion

The bug appears to be in how Claude Code captures stdout when bash spawns a child process via shebang interpretation.
The disk-based capture mechanism mentioned in this issue likely isn't receiving the stdout file descriptor from the shebang-spawned subprocess.

amdcq · 5 months ago

Working Workaround

mv ~/.bashrc ~/.bashrc_backup && claude

Run the following on a 2nd terminal after claude code launches

mv ~/.bashrc_backup ~/.bashrc

OR

Within Claude Code itself via the Bash mode !

<img width="338" height="115" alt="Image" src="https://github.com/user-attachments/assets/fed9bb83-647e-4e19-92b0-eb9976ea0d95" />

amdcq · 5 months ago

Issue is still present in 2.1.14

amdcq · 5 months ago

Issue is still present in 2.1.15, since 2.1.7 / 8 versions / 6-7 days that have passed that left claude code and the VSCode extension in a broken state with workarounds that can only do so much and don't account for edge cases. No response or update from Anthropic.

BarisGc · 5 months ago
Issue is still present in 2.1.15, since 2.1.7 / 8 versions / 6-7 days that have passed that left claude code and the VSCode extension in a broken state with workarounds that can only do so much and don't account for edge cases. No response or update from Anthropic.

Thanks for the workarounds. Is using version 2.1.7 the go-to for now, or is your workaround with the latest version recommended? Do you think regular users are missing out on many new features compared to the latest version?

caozhiyuan · 5 months ago

https://github.com/anthropics/claude-code/issues/13361 Reading a file with Read Tool on Windows takes 2-3 seconds, which is extremely slow, while it only takes 100ms on Mac/Linux. Claude has never fixed this issue. Moreover, they are planning to discontinue releasing via npm, so if bugs appear in claude code later, no one will know what the problem is. I've already switched to opencode . @BarisGc

caozhiyuan · 5 months ago

claude code is the software with the most bugs I've ever encountered, terrible.

amdcq · 5 months ago
> Issue is still present in 2.1.15, since 2.1.7 / 8 versions / 6-7 days that have passed that left claude code and the VSCode extension in a broken state with workarounds that can only do so much and don't account for edge cases. No response or update from Anthropic. Thanks for the workarounds. Is using version 2.1.7 the go-to for now, or is your workaround with the latest version recommended? Do you think regular users are missing out on many new features compared to the latest version?

Your milage may vary but I am unable to continue until this is fixed due to edge cases, missing features, broken features on previous / stable versions.

They still don't have QA testing to prevent this, still not fixed. You also have to adjust your expectations regarding this in general as it isn't 5 years ago when developing depended on human work; this is with the claim they make that Opus 4.5 / AI is so powerful that it writes better code and will replace programmers and makes it faster to fix bugs and catch bugs, yet at the moment it seems they are going in a loop of fixing features that break the previous broken features in a never ending cycle.

The tipping point is that I am still charged for my Max subscription with no option to pause until they fix this, and don't make them laugh by trying to get some sort of compensation due to a reasonable issue.

amdcq · 5 months ago

@ant-kurt @bogini

Still not fixed in 2.1.17

cubantobacco · 5 months ago

Additional Finding: Piped stdin to Node.js

Related to this bug, I found that piping input to Node.js also has stdout capture issues in Git Bash:

# stdout goes to stderr (BUG)
echo '{}' | node -e "console.log('test')" 1>/tmp/stdout.log 2>/tmp/stderr.log
cat /tmp/stdout.log  # Empty
cat /tmp/stderr.log  # Contains "test"

# These work correctly:
node script.js < file.txt           # File redirect
node script.js <<< '{}'             # Here-string
powershell -c "echo '{}' | node -e 'console.log(1)'"  # PowerShell

This affects Claude Code hooks which receive JSON input via pipe. Claude Code shows "hook error" messages in the terminal output because hook stdout is being routed to stderr, which Claude Code interprets as an error.

Test Matrix

| Input Method | Shell | stdout Destination |
|--------------|-------|-------------------|
| echo \| node | Git Bash | stderr (BUG) |
| node < file | Git Bash | stdout (OK) |
| node <<< str | Git Bash | stdout (OK) |
| echo \| node | PowerShell | stdout (OK) |

Impact on Hooks

  • Hooks execute successfully (exit code 0)
  • JSON response goes to stderr instead of stdout
  • Claude Code sees stderr output → displays "hook error" message
  • Hook functionality still works, but error messages are noisy/confusing

The existing workarounds (.cmd/.exe suffixes, BASH_ENV) don't help for this piped stdin case since it's Node.js execution, not a shell script shim.

Potential fix: Claude Code could check stderr for valid JSON when stdout is empty and exit code is 0, or use file-based IPC instead of pipes on Windows/Git Bash.

levnikolaevich · 5 months ago

Still not fixed in 2.1.17

caozhiyuan · 5 months ago

setx SHELLOPTS "braceexpand" can fix it. @levnikolaevich

caozhiyuan · 5 months ago

set env
"SHELLOPTS": "braceexpand"
in claude code settings.json

caozhiyuan · 5 months ago

There are too many bugs in the latest version, especially when using Claude Code in Windows environments. It is recommended to use version 2.1.7

codemile · 5 months ago

I've been using this workaround which solve some problems, but doesn't fix problems when using other scripts.

https://github.com/anthropics/claude-code/issues/18748#issuecomment-3762646331

IMPORTANT: This bug also exists in your settings.json hooks. Claude is not capturing output from hook commands that use scripts.

caozhiyuan · 5 months ago

@codemile try this

set env "SHELLOPTS": "braceexpand" in claude code settings.json
tkoho · 5 months ago

Workaround: set +o onecmd; npm run build 2>&1

Fixes npm / npx issues at the very least

boognish24 · 5 months ago

This is the worst timeline we live in. $200 / mo. software becomes unusable for days on end with no recourse.

caozhiyuan · 5 months ago
There are too many bugs in the latest version, especially when using Claude Code in Windows environments. It is recommended to use version 2.1.7

@boognish24

BarisGc · 5 months ago
> There are too many bugs in the latest version, especially when using Claude Code in Windows environments. It is recommended to use version 2.1.7 @boognish24

does this fix many, even all problems for a now?
{
"terminal.integrated.defaultProfile.windows": "Git Bash"
}

kaidokert · 5 months ago

Was hit by this issue, switching to stable / 2.1.7 works. latest has way too many problems - even claude doctor wouldn't run to completion in git bash and hangs at exit - that's maybe an easy regression test to add for each supported shell env

boognish24 · 5 months ago

Shell outputs still broken for me with 2.1.7, I previously used npm to install CC and never had issues, and nothing works on native now.

orro3790 · 5 months ago

+1 still struggling with this

caozhiyuan · 5 months ago
set env "SHELLOPTS": "braceexpand" in claude code settings.json

@orro3790 try this work if not

gulbanana · 5 months ago

Setting SHELLOPTS to braceexpand doesn't work for me.

levnikolaevich · 5 months ago

@bcherny @fvolcic Good afternoon! Please take a look at this issue. It has become difficult to work on Windows.

evanwon · 5 months ago

For what it's worth, I've been working around this issue (just for NPM) by adding the following to my CLAUDE.md:

### NPM Output Issue (nvm4w + Git Bash)

**When you need this:** If you run `npm` commands and see no output in the terminal, use this workaround. The commands still work - this is just a display issue with the bash wrapper.

On this Windows setup using nvm4w and Git Bash (MINGW64), Claude may incorrectly see `npm` commands as producing no output, even when they succeed. The commands actually run fine - Claude just can't read the output from the bash wrapper.

**Workaround:** Use the direct path to npm-cli.js:

node /c/nvm4w/nodejs/node_modules/npm/bin/npm-cli.js <command>

# Examples:
node /c/nvm4w/nodejs/node_modules/npm/bin/npm-cli.js run lint
node /c/nvm4w/nodejs/node_modules/npm/bin/npm-cli.js run typecheck
node /c/nvm4w/nodejs/node_modules/npm/bin/npm-cli.js test

This is a gnarly problem though because when Claude isn't seeing stdout, it'll churn and churn, flailing with increasingly elaborate solutions, when it's simply not seeing the output of its commands.

jake-r-smith-dev · 5 months ago

Best solution I have found so far, is to launch claude, then run /config and change "Auto-update channel" to "stable". Then close the session and run claude install in a new terminal - then launch claude again (which should be v2.1.7 at the time of writing) and it should work.

amdcq · 5 months ago

Still broken in v2.1.20

codemile · 5 months ago

@jake-r-smith-dev downgrading to 2.1.7 didn't work for me. Can you share your settings.json

<img width="641" height="406" alt="Image" src="https://github.com/user-attachments/assets/89562f7a-d2bb-493d-a9c7-dda93bcfeedb" />

amdcq · 5 months ago

@codemile I just downgraded to 2.1.7 to check this for you and I did not encounter the same result, it returned the output.

Perhaps try opening it in a new terminal to see if it is a cache issue.

codemile · 5 months ago

@amdcq the 2.1.7 version is working for me now, but I had to first uninstall Claude via Windows Settings and remove ~/.claude, then I could do a fresh install and switch to the stable channel. Now it works.

It seems if you switch to 2.1.7 and it's not working, then it's a cache related problem. You either reinstall Claude or figure out how to clear that cache.

BarisGc · 5 months ago

v2.1.7 just works for me with both powershell and bash in windows 11. Could
be a cache problem as mentioned before.

On Tue, Jan 27, 2026 at 5:04 PM Nick Foscarini @.***>
wrote:

codemile left a comment (anthropics/claude-code#18469) <https://github.com/anthropics/claude-code/issues/18469#issuecomment-3805396856> @amdcq <https://github.com/amdcq> the 2.1.7 version is working for me now, but I had to first uninstall Claude via Windows Settings and remove ~/.claude, then I could do a fresh install and switch to the stable channel. Now it works. It seems if you switch to 2.1.7 and it's not working, then it's a cache related problem. You either reinstall Claude or figure out how to clear that cache. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/18469#issuecomment-3805396856>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AVJKMJM3VA7WG3QAM2MZUAL4I5V7LAVCNFSM6AAAAACR3YI3BKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQMBVGM4TMOBVGY> . You are receiving this because you were mentioned.Message ID: @.***>
levnikolaevich · 5 months ago

v2.1.7 works for me too

codemile · 5 months ago

I am noticing a difference in the quality of Opus with 2.1.7 compared to when I used 2.1.19, and we don't have the feature to clear context when launching a plan. My assumptions are that the system prompts for 2.1.7 are not as good as the latest versions.

Is there anyone here with an Enterprise account who can use it to file a support request to get this fix?

codemile · 5 months ago

Would it be safe to assume that there are no humans from Anthropic monitoring GitHub issues and this entire repo is just a fake facade to showcase their vibe coding pipeline?

God, I hope this isn't the future of software engineering.

karl-keysingularity · 5 months ago

Not to turn this into a reddit thread but I suspect a few things are at play:
1) I doubt they have any idea this is broken.
2) Anthropic uses Macs. So if you could get their attention, I suspect their answer is "get a mac, bro." or "Gentoo".
3) I also think they are in a race and not really looking back over their shoulder, so features > bugfixes. They just got a new raise and are probably focused on getting people signed up & metrics
4) I dont think humans are looking at issues

eth0real · 5 months ago

I switched to running claude code under WSL. It is so much better. All the annoying bugs with the powershell version are non-existent in that version. Anthropic doesn't show much love for windows. I recommend to others that if possible, run it under WSL as it works so much better.

caozhiyuan · 5 months ago

I've uninstalled it and switched to opencode. Downgrading claude code to 2.1.7, npm --version still doesn't work, although it worked before. . Who knows what this software is doing in the background.

caozhiyuan · 5 months ago

@codemile Currently, claude code is also having issues on my end; deleting the .claude directory and reinstalling doesn't work either.

amdcq · 5 months ago
I've uninstalled it and switched to opencode. Downgrading claude code to 2.1.7, npm --version still doesn't work, although it worked before. . Who knows what this software is doing in the background.

If you switched from latest to stable in /config and then started a new claude code session and it still did not work. Try running the following which should resolve the cache issue

mv ~/.bashrc ~/.bashrc_backup

Launch claude code and then in a different terminal run

mv ~/.bashrc_backup ~/.bashrc

This is the current work around for using the latest version with the downside that there may be edge cases where this workaround doesn't work and as well as having to do this every time prior to launching claude code.

This workaround should hopefully fix it and you shouldn't have to run this every time since you aren't running the latest version.

caozhiyuan · 5 months ago
caozhiyuan · 5 months ago

in \.claude\shell-snapshots snapshot-bash-xxx.sh . if remove set -o onecmd, every thing ok.

caozhiyuan · 5 months ago

in windows , remove ~/.bashrc and ~/.bash_profile , will fix it. @codemile

amdcq · 5 months ago

@caozhiyuan Why would you remove ~/.bashrc instead of renaming it temporarily? There are custom instructions / settings stored here, i.e aliases, oh my bash, path exports, and so on

caozhiyuan · 5 months ago
@caozhiyuan Why would you remove ~/.bashrc instead of renaming it temporarily? There are custom instructions / settings stored here, i.e aliases, oh my bash, path exports, and so on

@amdcq There is no configuration in my two files. claude code bash automatically loads PATH, so no configuration is needed

amdcq · 5 months ago

@karl-keysingularity You do have a point. They mention first looking at issues submitted via /feedback and Github issues after that.

What I would recommend everyone doing is briefly updating to the newest version, starting a new claude code session and ask Claude Code to run something equivalent to npm --version or entering Bash mode by pressing ! and typing npm --version (this does the same thing, just bypasses asking Claude Code to run it)

After getting the expected output of "(No content)" proceed to create a bug report using /feedback via Claude Code

codemile · 5 months ago

@caozhiyuan sorry, I don't understand what the fix is here. Are you saying removing ~/.bashrc and ~/.bash_profile are the fixes, if so, why does it fix it?

caozhiyuan · 5 months ago

@codemile seems all bug raise by .claude shell snapshot dir sh file content. in windows delete .bashrc will cause sh content changed.

karl-keysingularity · 5 months ago

Huh, so I see its closed, but does that mean it's fixed, or it means "Im closing tickets that are open too long?"

tmaarcxs · 5 months ago
Huh, so I see its closed, but does that mean it's fixed, or it means "Im closing tickets that are open too long?"

It's fixed for me in 2.1.23.

km-anthropic contributor · 5 months ago

Hi, I'm Kashyap with the Claude Code team. I've tried repro'ing this bug a few times across different versions (including latest), and haven't been able to repro it.

In case you're still facing this issue please send the following info which will make it easier to debug
bash --version
winver
claude --version
echo $SHELL
which bash
bash -c -l "eval 'sh /path/to/script.sh' \< /dev/null"

evanwon · 5 months ago

@km-anthropic Hey Kashyap, thanks for engaging on this. Respectfully, you should re-open this ticket; closing it as can't reproduce with so much active discussion and repros from paying customers sends the wrong signal and a lot of us are having to work around this daily in every session which is quite frustrating.

I'm still observing the issue with npm commands in Claude Code v2.1.23 on Windows (native):

<img width="1057" height="825" alt="Image" src="https://github.com/user-attachments/assets/beb1fb43-ccae-4f37-887c-bcb32c766e0c" />

Here is the additional diagnostic information you requested:

  • bash --version: GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)
  • Windows version: Windows 11 25H2 (OS Build 26200.7623)
  • claude --version: 2.1.23 (Claude Code)
  • echo $SHELL: /usr/bin/bash
  • which bash: /usr/bin/bash
caozhiyuan · 5 months ago
@codemile seems all bug raise by .claude shell snapshot dir sh file content. in windows delete .bashrc .bash_profile will cause sh content changed.

@evanwon try it. The latest version has more bugs and is very slow. suggest use 2.1.7

codemile · 5 months ago

@caozhiyuan thanks, I'll test in the morning. I'm excited to see someone from Anthropic in the thread @km-anthropic thank you!

amdcq · 5 months ago

@km-anthropic I agree with what @evanwon has said, it doesn't make sense to close the issue, it's equivalent to "it works on my machine"

However I identified a reproducible process (which was one of the workarounds I put in this thread)

Setup

  • Fresh Install of Windows 11
  • Git 2.52.0 / (2.25.0.windows.1)
  • Node v24.13.0
  • Claude Code v2.1.25 - Native via irm https://claude.ai/install.ps1 | iex

This works by default however once you have a .bashrc created (either by oh-my-bash or other common tools or setups) it causes the issue in this thread. The .bashrc created in the video (through claude code bash mode for convenience) does not matter if it is blank or has actual settings / instructions inside of it.

Removing or renaming .bashrc i.e mv ~/.bashrc ~/.bashrc_backup and restarting Claude Code makes commands work properly again i.e npm.cmd -v >> npm -v OR docker.exe --version >> docker --version and on Claude Code v2.1.7 you can have both ~/.bashrc and Claude Code work normally.

Currently this breaks Claude Code for all Windows 11 Native users that have the .bashrc file. This breaks

  • Desktop App
  • VSCode extension
  • Claude Code CLI

https://github.com/user-attachments/assets/e5acffdf-87db-41c7-b75d-1089d0ab7dc5

Desktop App - Claude 1.1.1520

<img width="946" height="811" alt="Image" src="https://github.com/user-attachments/assets/a0b4a2c7-eca9-4443-8925-683583a1269e" />

VScode Extension - v2.1.25

<img width="491" height="892" alt="Image" src="https://github.com/user-attachments/assets/60bf8b6b-f45f-48ce-99bb-524a90c94fe4" />

km-anthropic contributor · 5 months ago

Hey folks, given some users mentioned it was working in the latest release I'd closed it. Thanks for letting me know it's still occurring, @ant-kurt and I are taking a look.

Thanks for the addl. details @evanwon and @amdcq

evanwon · 5 months ago

Thanks @km-anthropic!

Further confirming what @amdcq and others have identified, today I tried removing my ~/.bashrc file and it immediately resolved the issue. So it does seem like when .bashrc is present , or apparently even empty (in my case it just had export TERM=xterm-256color in it), Claude is no longer able to see stdout from things like npm.

<img width="989" height="381" alt="Image" src="https://github.com/user-attachments/assets/4e9e8676-e81e-49e3-ab61-358bf98688b0" />

km-anthropic contributor · 5 months ago

Hey folks, we found a repro & hotfixed it (it was in-fact due to some nuances with the presence of ~/.bashrc). Please claude update to get to the latest version. The fix is also noted in our changelog here.

I'll still leave this open for another day or two to confirm it's resolved. Thanks for your patience y'all!

amdcq · 5 months ago

Fixed / working for me personally as of v2.1.27

<img width="619" height="464" alt="Image" src="https://github.com/user-attachments/assets/217f184e-0df7-434c-8b9f-0bdfc62d1e70" />

intellia1 · 5 months ago

Confirmed working perfectly on my side. I tested both version 2.1.27 and now 2.1.29, and the issue is fully resolved in both cases. Thanks @km-anthropic !!!

claude[bot] contributor · 2 months ago

This issue was fixed as of version 2.1.27.

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.