npm start not refreshing new content on save on one computer, but is on another with almost exact same setup

cjones picture cjones · Aug 7, 2017 · Viewed 21.9k times · Source

I have my work computer which is a Windows 10 Pro and my laptop is a Windows 10 Home. Working on the same project on both: push and pull to Git. Learning React through Udemy. Both computers using Chrome. Both using Bash on Ubuntu on Windows with latest updates. Both using ConEmu for the console. Both npm -v = 3.10.10. Both node -v = 6.11.2. Hardware is different obviously, but not sure that is relevant and worth listing.

Anyway, this starter project I am playing around with, when I make changes to it and npm start is running, you can see activity in the console, hit refresh in the browser, and any changes made will be reflected.

On the laptop, this process does not work. Make change, save, no activity in console, refresh in browser does not reflect the changes. Have to restart npm start for changes to be reflected. A little irritating to say the least.

Anyway idea what might cause this? Really haven't come across anything in my Googling efforts.

Answer

tfist97 picture tfist97 · Oct 28, 2020

If you are using npm in WSL2.0 for development, please refer the last point in this- https://create-react-app.dev/docs/troubleshooting/#npm-start-doesnt-detect-changes

While WSL1.0 doesn't use a VM, WSL2.0 does use a lightweight VM, so adding

CHOKIDAR_USEPOLLING=true 

in a .env file in the project directory fixed the problem.

On a sidenote, you might wanna take a look at this