Categories
React Answers

How to set port in Next.js?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *