Create react app, reload not working
Year 2021
I had this issue in react ^17.0.2
I fixed it by adding a .env
file and setting FAST_REFRESH=false
.
Just create a .env
file in the root directory of your project and add FAST_REFRESH=false
in the file.
After too many searches I found Webpack watch uses inotify to observe file changes and in ubuntu it's set to a low value. a quick fix:
sudo -i
echo 1048576 > /proc/sys/fs/inotify/max_user_watches
exit
If you want change it permanently (from Ronald answer):
echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf
sudo sysctl -p
You may also need to add a .env
file in the root directory of your project with this line "FAST_REFRESH=false" as noted in create react app docs.
echo "FAST_REFRESH=false\n" | cat > .env