Author -  Sai gowtham

How to change a port number in Next.js app

In this tutorial, we are going to learn how to change a default port number in the next.js app.

Note: If we create a new next app using the create-next-app cli, by default the app runs on the port 3000.

Changing the Port number

  1. Open the next app in your favorite code editor.

  2. Navigate to the package.json file and add the -p flag with your desired port number to the following command.

"dev": "next dev -p 5000",

Here I added a port number 5000.

  1. Now, run the development server using npm run dev command your app will start on the port number you specified in step 2.
➜  nextjs-blog git:(master)npm run dev

> learn-starter@0.1.0 dev /Users/saigowtham/Desktop/nextjs-blog
> next dev -p 5000

[ wait ]  starting the development server ...
[ info ]  waiting on http://localhost:5000 ...
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
[ ready ] compiled successfully - ready on http://localhost:5000

If you want to change a port number temporarily, then you can use the following command.

npm run dev -- --p 5002

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY