Install and Authenticate the Vercel CLI
A global CLI installed during an old workshop has a remarkable ability to reappear at the worst time. Before we open either app, we'll install a 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 vercelThe CLI requires Node.js. If node --version fails, install the LTS release from nodejs.org before continuing.
Authenticate
Once installed, log into your Vercel account:
vercel loginThe 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 whoamiThe first command prints the CLI version. The second confirms which account is active.
Try It
Run both commands and check the output:
vercel --versionVercel CLI 59.1.4
FastAPI projects require Vercel CLI 48.1.8 or newer. If your version is older, upgrade with npm install -g vercel@latest before moving on.
vercel whoamiyour-vercel-username
If vercel whoami returns your username, authentication worked. If the command reports that you're logged out, run vercel login again.
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 --versionprints a version numbervercel whoamireturns your Vercel username
Solution
npm install -g vercel
vercel login
vercel --version # prints Vercel CLI 48.1.8 or newer
vercel whoami # prints your Vercel usernameWas this helpful?