Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 588
cjones Avatar asked Aug 07 '17 18:08

cjones


1 Answers

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

like image 146
tfist97 Avatar answered Sep 16 '22 21:09

tfist97