diff --git a/public/install.sh b/public/install.sh index caf9ec5..2aa814a 100755 --- a/public/install.sh +++ b/public/install.sh @@ -21,6 +21,11 @@ have() { command -v "$1" >/dev/null 2>&1; } say "Installing crawlproof (CrawlProof CLI)..." if have bun; then + # bun add -g writes into the nearest package.json above its global dir when + # that dir has none (e.g. ~/package.json): give it its own first. + BUN_GLOBAL="${BUN_INSTALL:-$HOME/.bun}/install/global" + mkdir -p "$BUN_GLOBAL" + [ -f "$BUN_GLOBAL/package.json" ] || printf '{}\n' > "$BUN_GLOBAL/package.json" bun add -g "$PKG@latest" BIN_DIR="${BUN_INSTALL:-$HOME/.bun}/bin" elif have npm && have node; then