Vercel CLI
The Vercel CLI lets you deploy, manage environment variables, and run a local development server from your terminal. It is the fastest way to interact with the Vercel platform without leaving your editor.
Installation
npm install -g vercel
Verify the installation:
vercel --version
Authentication
Log in to your Vercel account:
vercel login
This opens a browser window for authentication. Once complete, your session token is stored locally.
# Check which account is active
vercel whoami
Core Commands
| Command | Description |
|---|---|
vercel | Deploy the current directory (preview) |
vercel --prod | Deploy to production |
vercel dev | Start local dev server with Vercel features |
vercel env | Manage environment variables |
vercel domains | Manage custom domains |
vercel logs | View deployment logs in real time |
vercel inspect <url> | Show details about a deployment |
Linking a Project
Before deploying, link your local directory to a Vercel project:
vercel link
This creates a .vercel/ directory with the project configuration. The link is stored
locally and does not affect your Git repository.
Deploying from the Terminal
# Preview deployment (default)
vercel
# Production deployment
vercel --prod
# Deploy with build output only (skip prompts)
vercel --yes
Deployment Flags
| Flag | Effect |
|---|---|
--prod | Deploy to production environment |
--yes | Skip confirmation prompts |
--force | Force a new deployment even if nothing changed |
--archive=tgz | Upload project as a tarball for faster uploads |
Local Development Server
vercel dev runs your project locally with Vercel's serverless function emulation:
vercel dev --listen 3012
This is useful for testing serverless functions and environment variable injection without deploying.
If you use
direnvor a.envrcfile, you can runvercelcommands directly without manually sourcing credentials each time.