How to change Next.js port

You can start Next.js development server with the command

This will start the development server on port 3000.

If port 3000 is already used on your system, next.js will try to use another available port. If you want to assign a fixed port for your Next.js application, you can specify a port.

Next.js change port

To change the port, edit file package.json

In the file, find

Replace with

This will change the next.js application port to 8001.

If you only want to change one time, you can specify the port when you run “npm run dev” as follows.

This will run the next.js application on port 8081.

Another way to do the same is


See npm

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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