vercel dev
Learn how to replicate the Vercel deployment environment locally, and test your Vercel Project before deploying.The vercel dev
command is used to replicate the Vercel deployment environment locally, allowing you to test your Serverless Functions, Edge Functions, and Edge Middleware without requiring you to deploy each time a change is made.
vercel dev
command, make sure to install your Vercel Project's dependencies.If you're using a framework and your framework's Development Command already provides all the features you need, we recommend against using vercel dev
.
In the case of Next.js, for example, the framework's Development Command (next dev
) provides native support for Serverless Functions (placed in the pages/api
directory), Redirects, Rewrites, Headers and more – so there's no need to use vercel dev
. However, you can use vercel env pull
, to download the Development Environment Variables defined in your Project Settings.
Frameworks like Gatsby, on the other hand, do not offer a Development Command that supports Serverless Functions, for example. In those cases, vercel dev
acts as a helper that provides the necessary features and runs Gatsby's Development Command at the same time. In that case, you wouldn't use vercel env pull
because the Development Environment Variables defined in your Project Settings are downloaded into memory.
vercel dev
Using the vercel dev
command from the root of a Vercel Project directory.
These are options that only apply to the vercel dev
command, therefore, more information is provided.
The --listen
option, shorthand -l
, can be used to specify which port vercel dev
runs on.
vercel dev --listen 5005
Using the vercel dev
command with the --listen
option.
The --yes
option can be used to skip questions you are asked when setting up a new Vercel Project.
The questions will be answered with the default scope and current directory for the Vercel Project name and location.
vercel dev --yes
Using the vercel dev
command with the --yes
option.
The following global options can be passed when using the vercel dev
command:
For more information on global options and their usage, refer to the options section.