Skip to content

Commit 1052258

Browse files
authored
Merge pull request #15 from arjansingh/patch-1
Good fix — nvm users need dynamic path resolution. Welcome aboard @arjansingh.
2 parents 79f5aba + db584cc commit 1052258

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,24 @@ Create a wrapper script (e.g. `~/bin/claude-fixed`):
3636

3737
```bash
3838
#!/bin/bash
39-
CLAUDE_NPM_CLI="$HOME/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js"
39+
NPM_GLOBAL_ROOT="$(npm root -g 2>/dev/null)"
40+
41+
CLAUDE_NPM_CLI="$NPM_GLOBAL_ROOT/@anthropic-ai/claude-code/cli.js"
42+
CACHE_FIX="$NPM_GLOBAL_ROOT/claude-code-cache-fix/preload.mjs"
4043

4144
if [ ! -f "$CLAUDE_NPM_CLI" ]; then
4245
echo "Error: Claude Code npm package not found at $CLAUDE_NPM_CLI" >&2
4346
echo "Install with: npm install -g @anthropic-ai/claude-code" >&2
4447
exit 1
4548
fi
4649

47-
exec env NODE_OPTIONS="--import claude-code-cache-fix" node "$CLAUDE_NPM_CLI" "$@"
50+
if [ ! -f "$CACHE_FIX" ]; then
51+
echo "Error: claude-code-cache-fix not found at $CACHE_FIX" >&2
52+
echo "Install with: npm install -g claude-code-cache-fix" >&2
53+
exit 1
54+
fi
55+
56+
exec env NODE_OPTIONS="--import $CACHE_FIX" node "$CLAUDE_NPM_CLI" "$@"
4857
```
4958

5059
```bash

0 commit comments

Comments
 (0)