-
-
Save Rob--W/32235b0e16e353bafe06dd51358b1279 to your computer and use it in GitHub Desktop.
npm wrapper to avoid unbounded npm cache growth due to Claude's self-update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # npm wrapper to avoid unbounded npm cache growth due to Claude's self-update. | |
| # Claude updates daily, and each update adds ~200 MB to the cache in ~/.npm/ | |
| REAL_NPM=/usr/bin/npm | |
| case " $* " in | |
| *" install "*"@anthropic-ai/claude-code"*|*" i "*"@anthropic-ai/claude-code"*) | |
| d=$(mktemp -d) || exec "$REAL_NPM" "$@" | |
| npm_config_cache="$d" "$REAL_NPM" "$@" | |
| rc=$? | |
| rm -rf "$d" | |
| exit $rc | |
| ;; | |
| esac | |
| exec "$REAL_NPM" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment