claude-code - 💡(How to fix) Fix Grep tool broken: vendor/ripgrep not created by install.cjs when ignore-scripts=true in .npmrc

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The Grep tool fails with spawn .../vendor/ripgrep/arm64-darwin/rg ENOENT after a global install when the user's .npmrc has ignore-scripts=true. The install.cjs postinstall script only places the native claude binary — it does not create the vendor/ripgrep/ directory or place an rg binary there, even though the Grep tool expects one at that path.

Root Cause

The Grep tool fails with spawn .../vendor/ripgrep/arm64-darwin/rg ENOENT after a global install when the user's .npmrc has ignore-scripts=true. The install.cjs postinstall script only places the native claude binary — it does not create the vendor/ripgrep/ directory or place an rg binary there, even though the Grep tool expects one at that path.

Fix Action

Workaround

Manually copy the native binary to the expected vendor path:

mkdir -p ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin
cp ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/node_modules/@anthropic-ai/claude-code-darwin-arm64/claude \
   ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg

However, this gets wiped every time npm install -g @anthropic-ai/claude-code runs again (npm cleans the package tree and removes files not in the manifest).

Code Example

spawn /Users/.../.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg ENOENT

---

mkdir -p ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin
cp ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/node_modules/@anthropic-ai/claude-code-darwin-arm64/claude \
   ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg
RAW_BUFFERClick to expand / collapse

Summary

The Grep tool fails with spawn .../vendor/ripgrep/arm64-darwin/rg ENOENT after a global install when the user's .npmrc has ignore-scripts=true. The install.cjs postinstall script only places the native claude binary — it does not create the vendor/ripgrep/ directory or place an rg binary there, even though the Grep tool expects one at that path.

Environment

  • macOS (Darwin 25.3.0, Apple Silicon arm64)
  • Node v24.13.1, npm 11.9.0
  • Claude Code 2.1.114 (global install via npm install -g @anthropic-ai/claude-code)
  • .npmrc has ignore-scripts=true and prefix=~/.npm-global

Steps to reproduce

  1. Have ignore-scripts=true in ~/.npmrc
  2. npm install -g @anthropic-ai/claude-code
  3. Run node ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/install.cjs manually (since postinstall was skipped)
  4. claude --version → works (2.1.114)
  5. Use the Grep tool in a Claude Code session → fails:
    spawn /Users/.../.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg ENOENT

What I found

  • The native claude binary at node_modules/@anthropic-ai/claude-code-darwin-arm64/claude is a multi-call binary that responds as ripgrep 14.1.1 when invoked as rg (confirmed via copy + rename)
  • install.cjs only handles placing the claude binary into bin/claude.exe — it has no code for creating vendor/ripgrep/ or placing an rg copy there
  • The Grep tool hardcodes the path vendor/ripgrep/arm64-darwin/rg

Workaround

Manually copy the native binary to the expected vendor path:

mkdir -p ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin
cp ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/node_modules/@anthropic-ai/claude-code-darwin-arm64/claude \
   ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg

However, this gets wiped every time npm install -g @anthropic-ai/claude-code runs again (npm cleans the package tree and removes files not in the manifest).

Expected behavior

install.cjs should also create vendor/ripgrep/<arch>/rg (or the Grep tool should resolve rg from the platform package directly) so that the Grep tool works after a manual postinstall.

Additional context

  • ignore-scripts=true is a recommended security practice — this shouldn't break core tool functionality when combined with the documented manual postinstall workaround
  • The user shell also had rg aliased to the vendor path, so system-level ripgrep was also broken

extent analysis

TL;DR

The Grep tool fails due to a missing rg binary in the expected vendor/ripgrep directory, which can be temporarily fixed by manually copying the claude binary to the expected location.

Guidance

  • The issue is caused by the install.cjs script not creating the vendor/ripgrep directory or placing an rg binary there when ignore-scripts=true is set in the .npmrc file.
  • To verify the issue, check if the vendor/ripgrep/arm64-darwin/rg path exists and contains the rg binary after running the manual postinstall script.
  • A temporary workaround is to manually copy the claude binary to the expected vendor/ripgrep directory, as shown in the provided bash commands.
  • To mitigate the issue, consider modifying the install.cjs script to create the vendor/ripgrep directory and place an rg binary there, or update the Grep tool to resolve the rg binary from the platform package directly.

Example

mkdir -p ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin
cp ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/node_modules/@anthropic-ai/claude-code-darwin-arm64/claude \
   ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg

Notes

  • The provided workaround may not be permanent, as the npm install -g @anthropic-ai/claude-code command may remove the manually created files.
  • The issue highlights the importance of ensuring that the install.cjs script handles the ignore-scripts=true case correctly to avoid breaking core tool functionality.

Recommendation

Apply the workaround by manually copying the claude binary to the expected vendor/ripgrep directory, as this provides a temporary solution to the issue. However, it is recommended to modify the install.cjs script or update the Grep tool to provide a more permanent fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

install.cjs should also create vendor/ripgrep/<arch>/rg (or the Grep tool should resolve rg from the platform package directly) so that the Grep tool works after a manual postinstall.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Grep tool broken: vendor/ripgrep not created by install.cjs when ignore-scripts=true in .npmrc