Vercel
Complete Vercel CLI reference and documentation access.
When to Use
- - Deploying applications to Vercel
- Managing projects, domains, and environment variables
- Running local development server
- Viewing deployment logs and status
- Looking up Vercel documentation
Documentation
Fetch any Vercel docs page as markdown:
CODEBLOCK0
Get the full sitemap to discover all available pages:
curl -s "https://vercel.com/docs/sitemap.md" -H 'accept: text/markdown'
CLI Commands
Deployment
vercel / vercel deploy [path]
Deploy the current directory or specified path.
Options:
- -
--prod - Deploy to production - INLINECODE3 - Set runtime environment variables
- INLINECODE4 - Set build-time environment variables
- INLINECODE5 - Deploy prebuilt output (use with
vercel build) - INLINECODE7 - Force new deployment even if unchanged
- INLINECODE8 - Don't wait for deployment to finish
- INLINECODE9 - Skip prompts, use defaults
Examples:
CODEBLOCK2
vercel build
Build the project locally into
./vercel/output.
CODEBLOCK3
vercel dev [dir]
Start local development server.
Options:
- -
-l, --listen <URI> - Port/address (default: 0.0.0.0:3000)
Examples:
vercel dev # start on port 3000
vercel dev --listen 8080 # start on port 8080
Project Management
vercel link [path]
Link local directory to a Vercel project.
Options:
- -
-p, --project <NAME> - Specify project name - INLINECODE16 - Skip prompts
Examples:
CODEBLOCK5
vercel projects
Manage projects.
CODEBLOCK6
vercel pull [path]
Pull project settings and env vars from cloud.
CODEBLOCK7
Environment Variables
vercel env
Manage environment variables.
CODEBLOCK8
Environments: development, preview, INLINECODE22
Examples:
vercel env list production
vercel env add DATABASE_URL production
vercel env pull .env.local
Domains & Aliases
vercel domains
Manage domain names.
CODEBLOCK10
vercel alias
Manage deployment aliases.
CODEBLOCK11
Examples:
vercel alias set my-app-abc123.vercel.app my-app.vercel.app
vercel alias set my-app-abc123.vercel.app custom-domain.com
Deployments
vercel ls [app] / vercel list
List deployments.
CODEBLOCK13
vercel inspect [id]
Display deployment information.
CODEBLOCK14
vercel logs <url|id>
View runtime logs for a deployment.
Options:
- -
-j, --json - Output as JSON (compatible with jq)
Examples:
CODEBLOCK15
vercel promote <url|id>
Promote deployment to production.
CODEBLOCK16
vercel rollback [url|id]
Rollback to previous deployment.
CODEBLOCK17
vercel redeploy [url|id]
Rebuild and deploy a previous deployment.
CODEBLOCK18
vercel rm <id> / vercel remove
Remove a deployment.
CODEBLOCK19
Authentication & Teams
CODEBLOCK20
Other Commands
CODEBLOCK21
Global Options
Available on all commands:
| Option | Description |
|---|
| INLINECODE35 | Show help |
| INLINECODE36 |
Show version |
|
-d, --debug | Debug mode |
|
-t, --token <TOKEN> | Auth token |
|
-S, --scope | Set scope/team |
|
--cwd <DIR> | Working directory |
|
-A, --local-config <FILE> | Path to vercel.json |
|
--no-color | Disable colors |
Quick Reference
| Task | Command |
|---|
| Deploy | INLINECODE43 or INLINECODE44 |
| Dev server |
vercel dev |
| Link project |
vercel link |
| List deployments |
vercel ls |
| View logs |
vercel logs <url> |
| Add env var |
vercel env add <name> <env> |
| Pull env vars |
vercel env pull |
| Rollback |
vercel rollback |
| Add domain |
vercel domains add <domain> <project> |
| Get docs |
curl -s "https://vercel.com/docs/<path>" -H 'accept: text/markdown' |
| Docs sitemap |
curl -s "https://vercel.com/docs/sitemap.md" -H 'accept: text/markdown' |
Vercel
完整的 Vercel CLI 参考和文档访问。
使用场景
- - 将应用部署到 Vercel
- 管理项目、域名和环境变量
- 运行本地开发服务器
- 查看部署日志和状态
- 查阅 Vercel 文档
文档
以 Markdown 格式获取任意 Vercel 文档页面:
bash
curl -s https://vercel.com/docs/<路径> -H accept: text/markdown
获取完整站点地图以发现所有可用页面:
bash
curl -s https://vercel.com/docs/sitemap.md -H accept: text/markdown
CLI 命令
部署
vercel / vercel deploy [路径]
部署当前目录或指定路径。
选项:
- - --prod - 部署到生产环境
- -e KEY=VALUE - 设置运行时环境变量
- -b KEY=VALUE - 设置构建时环境变量
- --prebuilt - 部署预构建输出(与 vercel build 配合使用)
- --force - 即使未更改也强制重新部署
- --no-wait - 不等待部署完成
- -y, --yes - 跳过提示,使用默认值
示例:
bash
vercel # 部署当前目录
vercel --prod # 部署到生产环境
vercel /path/to/project # 部署指定路径
vercel -e NODE_ENV=production # 带环境变量
vercel build && vercel --prebuilt # 预构建部署
vercel build
在本地构建项目到 ./vercel/output。
bash
vercel build
vercel dev [目录]
启动本地开发服务器。
选项:
- - -l, --listen - 端口/地址(默认:0.0.0.0:3000)
示例:
bash
vercel dev # 在端口 3000 启动
vercel dev --listen 8080 # 在端口 8080 启动
项目管理
vercel link [路径]
将本地目录链接到 Vercel 项目。
选项:
- - -p, --project <名称> - 指定项目名称
- -y, --yes - 跳过提示
示例:
bash
vercel link
vercel link --yes
vercel link -p my-project
vercel projects
管理项目。
bash
vercel projects list # 列出所有项目
vercel projects add <名称> # 创建新项目
vercel projects inspect [名称] # 显示项目详情
vercel projects remove <名称> # 删除项目
vercel pull [路径]
从云端拉取项目设置和环境变量。
bash
vercel pull
环境变量
vercel env
管理环境变量。
bash
vercel env list [环境] # 列出环境变量
vercel env add <名称> [环境] # 添加环境变量
vercel env remove <名称> [环境] # 删除环境变量
vercel env pull [文件名] # 拉取到 .env.local
环境: development、preview、production
示例:
bash
vercel env list production
vercel env add DATABASE_URL production
vercel env pull .env.local
域名与别名
vercel domains
管理域名。
bash
vercel domains list # 列出域名
vercel domains add <域名> <项目> # 添加域名
vercel domains inspect <域名> # 显示域名信息
vercel domains remove <域名> # 删除域名
vercel domains buy <域名> # 购买域名
vercel domains transfer-in <域名> # 将域名转移到 Vercel
vercel alias
管理部署别名。
bash
vercel alias list # 列出别名
vercel alias set <部署> <别名> # 创建别名
vercel alias remove <别名> # 删除别名
示例:
bash
vercel alias set my-app-abc123.vercel.app my-app.vercel.app
vercel alias set my-app-abc123.vercel.app custom-domain.com
部署
vercel ls [应用] / vercel list
列出部署。
bash
vercel ls
vercel ls my-project
vercel inspect [ID]
显示部署信息。
bash
vercel inspect <部署URL或ID>
vercel logs
查看部署的运行时日志。
选项:
- - -j, --json - 以 JSON 格式输出(兼容 jq)
示例:
bash
vercel logs my-app.vercel.app
vercel logs <部署ID> --json
vercel logs <部署ID> --json | jq select(.level == error)
vercel promote
将部署提升到生产环境。
bash
vercel promote <部署URL或ID>
vercel rollback [URL|ID]
回滚到之前的部署。
bash
vercel rollback
vercel rollback <部署URL或ID>
vercel redeploy [URL|ID]
重新构建并部署之前的部署。
bash
vercel redeploy <部署URL或ID>
vercel rm / vercel remove
删除部署。
bash
vercel rm <部署URL或ID>
认证与团队
bash
vercel login [邮箱] # 登录或创建账户
vercel logout # 退出登录
vercel whoami # 显示当前用户
vercel switch [作用域] # 切换作用域/团队
vercel teams # 管理团队
其他命令
bash
vercel open # 在仪表盘中打开项目
vercel init [示例] # 从示例初始化
vercel install [名称] # 安装市场集成
vercel integration # 管理集成
vercel certs # 管理 SSL 证书
vercel dns # 管理 DNS 记录
vercel bisect # 二分查找引入错误的部署
全局选项
适用于所有命令:
| 选项 | 描述 |
|---|
| -h, --help | 显示帮助 |
| -v, --version |
显示版本 |
| -d, --debug | 调试模式 |
| -t, --token <令牌> | 认证令牌 |
| -S, --scope | 设置作用域/团队 |
| --cwd <目录> | 工作目录 |
| -A, --local-config <文件> | vercel.json 的路径 |
| --no-color | 禁用颜色 |
快速参考
| 任务 | 命令 |
|---|
| 部署 | vercel 或 vercel --prod |
| 开发服务器 |
vercel dev |
| 链接项目 | vercel link |
| 列出部署 | vercel ls |
| 查看日志 | vercel logs
|
| 添加环境变量 | vercel env add <名称> <环境> |
| 拉取环境变量 | vercel env pull |
| 回滚 | vercel rollback |
| 添加域名 | vercel domains add <域名> <项目> |
| 获取文档 | curl -s https://vercel.com/docs/<路径> -H accept: text/markdown |
| 文档站点地图 | curl -s https://vercel.com/docs/sitemap.md -H accept: text/markdown |