Netlify CLI serve command
serve
Build the project for production and serve locally. This does not watch the code for changes, so if you need to rebuild your project then you must exit and run serve
again.
Usage
netlify serve
Flags
context
(string) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) orbranch:your-branch
whereyour-branch
is the name of a branch (default: dev)country
(string) - Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables —geo=mock automatically)dir
(string) - dir with static filesfilter
(string) - For monorepos, specify the name of the application to run the command infunctions
(string) - specify a functions folder to servefunctions-port
(string) - port of functions servergeo
(cache | mock | update) - force geolocation data to be updated, use cached data from the last 24h if found, or use a mock locationoffline
(boolean) - Disables any features that require network accessport
(string) - port of netlify devdebug
(boolean) - Print debugging informationauth
(string) - Netlify auth token - can be used to run this command without logging in
Examples
netlify serveBROWSER=none netlify serve # disable browser auto openingnetlify serve --context production # Use env var values from production contextnetlify serve --context deploy-preview # Use env var values from deploy-preview contextnetlify serve --context branch:feat/make-it-pop # Use env var values from the feat/make-it-pop branch context or branch-deploy context