A LITTLE CORNER OF MY WORLD

Read a few words, keep a little time

Every moment worth recording has a light of its own.

Back to all posts
Dev notes

How to use the Vercel CLI

Link and deploy your project faster without having to enter into the site web.

On this page
  1. Install the tool
  2. Login to your account
  3. Short configurations
  4. Deploy a new project from a directory
  5. Add environment variable
  6. Link your project to a Git(hub) repository
  7. Deploy
  8. Manage other projects
  9. Logout

First, you have to create a free account on Vercel

Install the tool

You probably need to configure your shell for npm with

PATH="$PATH:$HOME/.npm/bin"
export npm_config_prefix="$HOME/.npm"

After that, just install vercel globally

npm i -g vercel@latest

Login to your account

vercel login

Short configurations

vercel telemetry status
vercel telemetry disable

Deploy a new project from a directory

For a single repo with one project.

cd lolthway
vercel

You will have some question/answer:

> Create a new project
> Name? lolthway
> Connect this Git repository to automatically deploy changes on every push? y
> Detected Astro (dist)
> Customize settings? N

After all that, your project should be deployed at the address https://lolthway.vercel.app

Add environment variable

vercel env ls
vercel env add SITE_URL

And write the value you want e.g: https://lolthway.vercel.app/

vercel link

Like this, every commit will trigger a new deployment to Vercel.

Deploy

See if all is ok with:

vercel deploy

And if no error:

vercel deploy --prod

Manage other projects

vercel project ls
vercel project add
vercel project rm
vercel project inspect [project-name]

Logout

vercel logout
✿

Thank you for reading. I hope these words were useful.

Szorfein
Szorfein / Author

A little code, a little everyday life. Say hello in the guestbook. Guestbook