Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
193
rated 0 times [  195] [ 2]  / answers: 1 / hits: 24512  / 3 Years ago, sat, april 10, 2021, 12:00:00

I'm having trouble with Next.js, basically it doesn't auto refresh local host index page whenever I make a change.


I created a Next.js app using npx create-next-app --use-npm. I started the local server using npm start, then I edited the h1 tag in index.js file, changing it from <h1>First Page</h1> to <h1>Second Page</h1>. Then I saved the file.


However, my local serve doesn't auto refresh and reflect the change I just made. I have to run npm run build then npm run start to be able to see the change.


Appreciate any suggestions, or maybe point me to the right direction on solving this, cuz not be able to see the auto refresh really slows down the dev process :(


More From » reactjs

 Answers
5

You have to use npm run dev



These scripts refer to the different stages of developing an application:


dev - Runs next dev which starts Next.js in development mode


build - Runs next build which builds the application for production usage


start - Runs next start which starts a Next.js production server



source: https://nextjs.org/docs/getting-started


[#50322] Tuesday, March 16, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
parisc

Total Points: 438
Total Questions: 119
Total Answers: 119

Location: Turkmenistan
Member since Sat, Apr 16, 2022
2 Years ago
;