Skip to content
Advertisement

running a Development server on NextJS (on the network)

While using ReactJS, when we use the command npm start, It starts the development server on localhost:3000 and also on the network, 192.168.1.2:3000 This was super easy, I could test my app on all the devices by going into that address.

Recently I started learning NextJS and when I run the command npm run dev, I only see that it starts the development server on the local machine, not on the network. Is there a way to make it work just like it did with pure reactjs?

posting the screenshot, this is what it looks like with nextjs

Advertisement

Answer

It also listens on your local IP, just find out your local ip and do “192.168.1.x:3000” — this would be your IP , you will see the server running on that port.

To find local IP: Open your terminal and run the command ipconfig for windows or ifconfig for MacBook. You’ll see the network you’re currently connected to, the IPv4 address being the current local IP address.

Advertisement