Vercel Logo

Install and authenticate the Vercel CLI

That CLI you installed for a workshop may still be the one your terminal finds. Before we open either app, we'll install the current Vercel CLI and connect it to the account we intend to use.

Outcome

Install the Vercel CLI and verify that it can access your Vercel account.

Hands-on exercise 1.1

Install

The CLI ships as an npm package. Install it globally so you can run it from anywhere:

npm install -g vercel@latest

The CLI requires Node.js. If node --version fails, install the LTS release from nodejs.org before continuing.

Authenticate

Log into your Vercel account:

vercel login

The CLI starts an OAuth device flow and prints a verification URL. Open the URL on any browser-capable device, check that the location and request time match, then approve the login. The terminal confirms when authentication finishes:

> Success! Authentication complete.

Verify

Confirm the CLI is installed and authenticated:

vercel --version
vercel whoami

The first command prints the CLI version. The second confirms which account is active.

Token-based auth

In CI, authenticate with a Vercel access token instead of an interactive login. Pass the token to CLI commands with the --token option.

Try It

Run both commands and check the output:

vercel --version
Vercel CLI 60.1.3

Use the current Vercel CLI for this course. An older CLI may support FastAPI but lack support for the Services configuration and service bindings we'll use. Your version may be newer than the example above.

vercel whoami
your-vercel-username

If vercel whoami returns your username, authentication worked. If the command reports that you're logged out, run vercel login again.

Multiple accounts

The CLI stores one active session at a time. If you have a personal and a work Vercel account, vercel login will switch you to whichever you authenticate as. Run vercel whoami any time you're unsure which account is active.

Commit

We haven't changed any project files, so there is nothing to commit yet.

Troubleshooting

vercel login waits for approval: Open the verification URL printed in the terminal and enter the device code if prompted. The browser can be on another device.

vercel: command not found after install: The global npm bin directory may be missing from your PATH. Run npm config get prefix to locate it, then add its bin directory to your PATH. You can also run the CLI through npx vercel.

Done-When

  • vercel --version prints a version number
  • vercel whoami returns your Vercel username

Solution

npm install -g vercel@latest
vercel login
vercel --version  # check the installed version
vercel whoami     # prints your Vercel username

Was this helpful?

supported.