Sometimes, we want to set port in Next.js.
In this article, we’ll look at how to set port in Next.js.
How to set port in Next.js?
To set port in Next.js, we can use the -p
option.
For instance, in package.json, we write
{
//...
"scripts": {
"dev": "next -p 8080"
}
//...
}
to add -p 8080
to the dev script command to run the Next.js project on port 8080.
Conclusion
To set port in Next.js, we can use the -p
option.