vercel deploy
The command deploys Vercel projects, executable from the project's root directory or by specifying a path. You can omit 'deploy' in , as is the only command that operates without a subcommand. This document will use 'vercel' to refer to .
Using the vercel command from the root of a Vercel
project directory.
Using the vercel command and supplying a path to the
root directory of the Vercel project.
Using the vercel command to deploy a prebuilt Vercel
project, typically with vercel build. See
vercel build and
Build Output API for more details.
When deploying, is always the Deployment URL.
Using the vercel command to deploy and write
stdout to a text file. When deploying,
stdout is always the Deployment URL.
In the following example, you create a bash script that you include in your CI/CD workflow. The goal is to have all preview deployments be aliased to a custom domain so that developers can bookmark the preview deployment URL. Note that you may need to define the scope when using
The script deploys your project and assigns the deployment URL saved in
stdout to the custom domain using
vercel alias.
If you need to check for errors when the command is executed such as in a CI/CD workflow, use . If the exit code is anything other than , an error has occurred. The following example demonstrates a script that checks if the exit code is not equal to 0:
These are options that only apply to the command.
The option can be used to upload and deploy the results of a previous execution located in the .vercel/output directory. See vercel build and Build Output API for more details.
When using the flag, no deployment ID will be made available for supported frameworks (like Next.js) to use, which means Skew Protection will not be enabled. Additionally, System Environment Variables will be missing at build time, so frameworks that rely on them at build time may not function correctly. If you need Skew Protection or System Environment Variables, do not use the flag or use Git-based deployments.
You should also consider using the archive option to minimize the number of files uploaded and avoid hitting upload limits:
This example uses the command to build your project locally. It then uses the and options on the command to compress the build output and then deploy it.
The option, shorthand , can be used to provide environment variables to the build step.
Using the vercel command with the
--build-env option.
The option can be used to skip questions you are asked when setting up a new Vercel project. The questions will be answered with the provided defaults, inferred from and the folder name.
Using the vercel command with the
--yes option.
The option, shorthand , can be used to provide environment variables at runtime.
Using the vercel command with the
--env option.
The --name option has been deprecated in favor of
Vercel project linking, which allows you to link
a Vercel project to your local codebase when you run
vercel.
The option, shorthand , can be used to provide a Vercel project name for a deployment.
Using the vercel command with the
--name option.
The option can be used to create a deployment for a production domain specified in the Vercel project dashboard.
Using the vercel command with the
--prod option.
This CLI option will override the Auto-assign Custom Production Domains project setting.
Must be used with . The option will disable the automatic promotion (aliasing) of the relevant domains to a new production deployment. You can use to complete the domain-assignment process later.
Using the vercel command with the
--skip-domain option.
The option can be used to ensures the source code is publicly available at the path.
Using the vercel command with the
--public option.
The option can be used to specify which regions the deployments Vercel functions should run in.
Using the vercel command with the
--regions option.
The option does not wait for a deployment to finish before exiting from the command.
The option, shorthand , is used to force a new deployment without the build cache.
The option is used to retain the build cache when using .
The option compresses the deployment code into one or more files before uploading it. This option should be used when deployments include thousands of files to avoid rate limits such as the files limit.
In some cases, makes deployments slower. This happens because the caching of source files to optimize file uploads in future deployments is negated when source files are archived.
The option, shorthand , also prints the build logs.
Using the vercel deploy command with the
--logs option, to view logs from the build process.
The option, shorthand , is used to add metadata to the deployment.
Use the option to define the environment you want to deploy to. This could be production, preview, or a custom environment.
The following global options can be passed when using the vercel deploy command:
For more information on global options and their usage, refer to the options section.
Was this helpful?