Skip to content

Instantly share code, notes, and snippets.

@Rob--W
Created September 18, 2026 15:31
Show Gist options
  • Select an option

  • Save Rob--W/32235b0e16e353bafe06dd51358b1279 to your computer and use it in GitHub Desktop.

Select an option

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.
#!/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