vercel-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVercel Deployment Skill
Vercel 部署技能
Goal: Seamlessly deploy any frontend/full-stack application to Vercel global edge network.
目标:将任意前端/全栈应用无缝部署到Vercel全球边缘网络。
1. Prerequisites
1. 前提条件
- CLI: (Install via
vercel)npm i -g vercel - Auth: User must be logged in () or provide
vercel login.VERCEL_TOKEN
- CLI:(通过
vercel安装)npm i -g vercel - 身份验证:用户必须已登录()或提供
vercel login。VERCEL_TOKEN
2. Deployment Workflow
2. 部署流程
-
Detection:
- Scanner checks for frameworks (Next.js, Vite, Remix, Astro).
package.json - Identifies build command () and output directory (
npm run buildordist)..next
- Scanner checks
-
Configuration:
- Generates if custom headers/rewrites are needed.
vercel.json - Sets project settings (Root Directory, Framework Preset).
- Generates
-
Execution:
- Preview: (For testing feature branches).
vercel --no-prod - Production: (For live release).
vercel --prod
- Preview:
-
Verification:
- Checks deployment status via .
vercel inspect <url> - Returns the Claimable URL for the user.
- Checks deployment status via
-
检测:
- 扫描器检查中的框架(Next.js、Vite、Remix、Astro)。
package.json - 识别构建命令()和输出目录(
npm run build或dist)。.next
- 扫描器检查
-
配置:
- 如果需要自定义头信息/重写规则,生成。
vercel.json - 设置项目参数(根目录、框架预设)。
- 如果需要自定义头信息/重写规则,生成
-
执行:
- 预览部署:(用于测试功能分支)。
vercel --no-prod - 生产部署:(用于正式发布)。
vercel --prod
- 预览部署:
-
验证:
- 通过检查部署状态。
vercel inspect <url> - 向用户返回可认领的URL。
- 通过
3. Environment Variables
3. 环境变量
- Auto-Sync: Pulls from Vercel Project Settings (
.env).vercel env pull - Push: Pushes local to Vercel (Interactive confirmation required).
.env
- 自动同步:从Vercel项目设置中拉取文件(
.env)。vercel env pull - 推送:将本地文件推送到Vercel(需要交互式确认)。
.env
4. Troubleshooting common errors
4. 常见错误排查
- Build Fail: Usually due to strict type checking or linting in CI. Suggest ONLY for hotfixes.
ignoreBuildErrors: true - Missing Secrets: Check if is active in CI/CD environment.
VERCEL_TOKEN
Command Reference:
- : Link local folder to remote project.
vercel link - : Deploy preview.
vercel deploy - : Deploy production.
vercel deploy --prod
- 构建失败:通常是由于CI中的严格类型检查或代码审查导致。仅建议在热修复时设置。
ignoreBuildErrors: true - 密钥缺失:检查CI/CD环境中是否有效。
VERCEL_TOKEN
命令参考:
- : 将本地文件夹关联到远程项目。
vercel link - : 部署预览版本。
vercel deploy - : 部署生产版本。
vercel deploy --prod