{"record":{"id":"0c8561143512bba7","repo":"zarazhangrui/frontend-slides","slug":"red-nc","errorCode":null,"errorMessage":"${RED}✗${NC} $*","messagePattern":"\\$\\{RED\\}✗\\$\\{NC\\} \\$\\*","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/frontend-slides/skills/frontend-slides/scripts/deploy.sh","lineNumber":32,"sourceCode":"#   3. Deploys the slide deck to a public URL\n#   4. Prints the live URL\n#\n# The deployed URL is permanent and works on any device (mobile, tablet, desktop).\n# No server to maintain — Vercel hosts it for free.\nset -euo pipefail\n\n# ─── Colors ────────────────────────────────────────────────\nRED='\\033[0;31m'\nGREEN='\\033[0;32m'\nCYAN='\\033[0;36m'\nYELLOW='\\033[1;33m'\nBOLD='\\033[1m'\nNC='\\033[0m'\n\ninfo()  { echo -e \"${CYAN}ℹ${NC} $*\"; }\nok()    { echo -e \"${GREEN}✓${NC} $*\"; }\nwarn()  { echo -e \"${YELLOW}⚠${NC} $*\"; }\nerr()   { echo -e \"${RED}✗${NC} $*\" >&2; }\n\n# ─── Input validation ─────────────────────────────────────\n\nif [[ $# -lt 1 ]]; then\n    err \"Usage: bash scripts/deploy.sh <path-to-slide-folder-or-html>\"\n    err \"\"\n    err \"Examples:\"\n    err \"  bash scripts/deploy.sh ./my-pitch-deck/\"\n    err \"  bash scripts/deploy.sh ./presentation.html\"\n    exit 1\nfi\n\nINPUT=\"$1\"\n\n# If input is a single HTML file, create a temp directory with it as index.html\nif [[ -f \"$INPUT\" && \"$INPUT\" == *.html ]]; then\n    DEPLOY_DIR=$(mktemp -d)\n    cp \"$INPUT\" \"$DEPLOY_DIR/index.html\"","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/zarazhangrui/frontend-slides/blob/9906a34d640d2111f724544cbc50f7f130569ae1/plugins/frontend-slides/skills/frontend-slides/scripts/deploy.sh#L14-L50","documentation":"This message is the output of the err() helper in deploy.sh (line 32), a bash script that deploys a slide deck to Vercel. It is not a runtime exception: err() prints a red ✗ plus its arguments to stderr and the script exits 1 whenever validation or a deployment step fails. Which message you get depends on where validation failed — missing usage argument, missing index.html, not-logged-in, or 'Deployment failed:'.","triggerScenarios":"Calling deploy.sh with no arguments (usage error); passing a path that is neither an existing .html file nor a directory; passing a folder without an index.html inside; 'vercel login' failing or being aborted during the interactive login; the underlying 'vercel deploy <dir> --yes --prod' command exiting non-zero (auth token expired, network error, invalid project name).","commonSituations":"Running the script from the wrong working directory so the relative path to the deck is wrong; passing a folder that contains presentation.html instead of the required index.html; Vercel CLI not authenticated (never ran vercel login) or token expired in CI; deploying a directory whose name sanitizes to an empty/invalid Vercel project name.","solutions":["Re-run with a valid argument: bash scripts/deploy.sh ./my-deck/ (a folder containing index.html) or bash scripts/deploy.sh ./deck.html","If deploying a folder, ensure it contains an index.html at its root (rename presentation.html to index.html or pass the single HTML file directly)","Run 'vercel login' manually and verify with 'vercel whoami', then re-run the deploy script","Read the 'Deployment failed:' output block the script prints for the underlying vercel error and fix that cause (auth, network, project name)","Confirm Node.js/npx are installed; the script exits early with an err message if npx is missing"],"exampleFix":"// before\n$ bash scripts/deploy.sh            # no argument\n✗ Usage: bash scripts/deploy.sh <path-to-slide-folder-or-html>\n\n// after\n$ bash scripts/deploy.sh ./my-pitch-deck/   # folder containing index.html\n✓ Slides deployed successfully!\n  Live URL: https://my-pitch-deck.vercel.app","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# Pre-flight checks before running deploy.sh\nset -euo pipefail\nDECK=\"$1\"\n[[ $# -ge 1 ]] || { echo \"Usage: deploy.sh <folder-or-html>\" >&2; exit 1; }\nif [[ -d \"$DECK\" ]]; then\n  [[ -f \"$DECK/index.html\" ]] || { echo \"'$DECK' has no index.html\" >&2; exit 1; }\nelif [[ -f \"$DECK\" && \"$DECK\" == *.html ]]; then\n  : # single-file deck is fine\nelse\n  echo \"'$DECK' is not a valid HTML file or directory\" >&2; exit 1\nfi\ncommand -v npx >/dev/null || { echo \"Node.js required\" >&2; exit 1; }\nvercel whoami >/dev/null 2>&1 || { echo \"Run 'vercel login' first\" >&2; exit 1; }","typeGuard":"is_valid_deck_input() {\n  local p=\"$1\"\n  [[ -f \"$p\" && \"$p\" == *.html ]] || [[ -d \"$p\" && -f \"$p/index.html\" ]]\n}","tryCatchPattern":"# deploy.sh already exits non-zero on failure; wrap the call and inspect stderr\nif ! bash scripts/deploy.sh \"$DECK\" 2>deploy.err; then\n  cat deploy.err >&2\n  # distinguish failure modes:\n  grep -q 'not logged in\\|Login failed' deploy.err && vercel login\n  grep -q 'index.html' deploy.err && echo \"Add an index.html to the deck folder\"\n  exit 1\nfi","preventionTips":["Always pass the deck folder (containing index.html) or a single .html file — never an arbitrary path","Run 'vercel login' and 'vercel whoami' before deploying, especially in CI where tokens expire","Verify the deck loads locally from the filesystem (open index.html) before deploying","Run the script from the project root or use absolute paths for the deck","If deployment fails, read the vercel output block the script prints — it contains the root cause"],"tags":["bash","vercel","cli","deployment","script-usage"],"backgroundTag":"cli-script-usage-error","analyzedSha":"9906a34d640d2111f724544cbc50f7f130569ae1","analyzedAt":"2026-08-29T08:54:05.395Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}