vercel-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVercel CLI Skill
Vercel CLI Skill
The Vercel CLI ( or ) deploys, manages, and develops projects on the Vercel platform from the command line. Use for full flag details on any command.
vercelvcvercel <command> -hVercel CLI(或)可通过命令行在Vercel平台上部署、管理和开发项目。使用查看任意命令的完整参数详情。
vercelvcvercel <command> -hCritical: Project Linking
关键:项目关联
Commands must be run from the directory containing the folder (or a subdirectory of it). How gets set up depends on your project structure:
.vercel.vercel- : Created by
.vercel/project.json. Links a single project. Fine for single-project repos, and can work in monorepos if there's only one project.vercel link - : Created by
.vercel/repo.json. Links a repo that may contain multiple projects. Always a good idea when any project has a non-root directory (e.g.,vercel link --repo).apps/web
Running from a project subdirectory (e.g., ) skips the "which project?" prompt since it's unambiguous.
apps/web/When something goes wrong, check how things are linked first — look at what's in and whether it's or . Also verify you're on the right team with — linking while on the wrong team is a common mistake.
.vercel/project.jsonrepo.jsonvercel whoami命令必须在包含文件夹的目录(或其子目录)中运行。的设置方式取决于你的项目结构:
.vercel.vercel- :由
.vercel/project.json创建。关联单个项目。适用于单项目仓库,若单仓库中只有一个项目,也可用于多项目仓库(monorepo)。vercel link - :由
.vercel/repo.json创建。关联可能包含多个项目的仓库。当任何项目位于非根目录(如vercel link --repo)时,建议使用此方式。apps/web
从项目子目录(如)运行命令时,会跳过“选择哪个项目?”的提示,因为目标明确。
apps/web/出现问题时,首先检查关联方式——查看目录下的内容是还是。同时使用确认你是否在正确的团队中——关联时选错团队是常见错误。
.vercel/project.jsonrepo.jsonvercel whoamiQuick Start
快速开始
bash
npm i -g vercel
vercel login
vercel link # single projectbash
npm i -g vercel
vercel login
vercel link # 单项目OR
或
vercel link --repo # monorepo
vercel pull
vercel dev # local development
vercel deploy # preview deployment
vercel --prod # production deployment
undefinedvercel link --repo # 多项目仓库
vercel pull
vercel dev # 本地开发
vercel deploy # 预览部署
vercel --prod # 生产环境部署
undefinedDecision Tree
决策树
Use this to route to the correct reference file:
- Deploy →
references/deployment.md - Local development →
references/local-development.md - Environment variables →
references/environment-variables.md - CI/CD automation →
references/ci-automation.md - Domains or DNS →
references/domains-and-dns.md - Projects or teams →
references/projects-and-teams.md - Logs, debugging, or accessing preview deploys →
references/monitoring-and-debugging.md - Blob storage →
references/storage.md - Integrations (databases, storage, etc.) →
references/integrations.md - Access a preview deployment → use (see
vercel curl)references/monitoring-and-debugging.md - CLI doesn't have a command for it → use as a fallback (see
vercel api)references/advanced.md - Advanced (API, webhooks) →
references/advanced.md - Global flags →
references/global-options.md - First-time setup →
references/getting-started.md
使用以下指引找到对应的参考文档:
- 部署 →
references/deployment.md - 本地开发 →
references/local-development.md - 环境变量 →
references/environment-variables.md - CI/CD自动化 →
references/ci-automation.md - 域名或DNS →
references/domains-and-dns.md - 项目或团队 →
references/projects-and-teams.md - 日志、调试或访问预览部署 →
references/monitoring-and-debugging.md - Blob存储 →
references/storage.md - 集成(数据库、存储等) →
references/integrations.md - 访问预览部署 → 使用(详见
vercel curl)references/monitoring-and-debugging.md - CLI无对应命令 → 使用作为替代方案(详见
vercel api)references/advanced.md - 高级功能(API、Webhooks) →
references/advanced.md - 全局参数 →
references/global-options.md - 首次设置 →
references/getting-started.md
Anti-Patterns
反模式
- Wrong link type in monorepos with multiple projects: creates
vercel link, which only tracks one project. Useproject.jsoninstead. When things break, checkvercel link --repofirst..vercel/ - Letting commands auto-link in monorepos: Many commands implicitly run if
vercel linkdoesn't exist. This creates.vercel/, which may be wrong. Runproject.json(orvercel link) explicitly first.--repo - Linking while on the wrong team: Use to check,
vercel whoamito change.vercel teams switch - Forgetting in CI: Required to skip interactive prompts.
--yes - Using after
vercel deploywithoutvercel build: The build output is ignored.--prebuilt - Hardcoding tokens in flags: Use env var instead of
VERCEL_TOKEN.--token - Disabling deployment protection: Use instead to access preview deploys.
vercel curl
- 多项目仓库中使用错误的关联类型:会创建
vercel link,仅能跟踪单个项目。应改用project.json。出现问题时,先检查vercel link --repo目录。.vercel/ - 在多项目仓库中让命令自动关联:若不存在,许多命令会隐式运行
.vercel/,这会创建可能不符合需求的vercel link。请先显式运行project.json(或vercel link)。--repo - 关联时选错团队:使用检查当前团队,使用
vercel whoami切换团队。vercel teams switch - 在CI中忘记添加:需要此参数跳过交互式提示。
--yes - 运行后使用
vercel build却未加vercel deploy:构建产物会被忽略。--prebuilt - 在参数中硬编码令牌:应使用环境变量替代
VERCEL_TOKEN参数。--token - 禁用部署保护:应使用访问预览部署。
vercel curl