Application development server create-react-app is not automatically updated
I am following a tutorial on React using create-react-app. The app is created with create-react-app v1.3.0
create-react-app my-app
Developer server is managed
npm start
After changing the code several times, the browser is not updated in real time / hot reload with the changes. Refreshing the browser doesn't help. Only stopping the dev server and restarting it will commit the new code changes.
source to share
Have you seen the Troubleshooting section in the User's Guide?
It describes several common causes of this problem :
When you save the file while running
npm start
, the browser should update the updated code.If it doesn't, try one of the following:
- If your project is in the Dropbox folder, try moving it.
- If the watcher does not see the file named
index.js
and you are referencing it by folder name, you need to restart the watcher due to a Webpack error.- Some editors such as Vim and IntelliJ have a "write safe" feature that currently breaks the observer. You will need to disable it. Follow the instructions in 'Disable paging file creation in vim' .
- If your project path contains parentheses, try moving the project to a path without them. This is caused by a Webpack observer bug .
- On Linux and macOS, you may need to adjust your system settings to add more watchers.
- If the project is running inside a virtual machine such as (Vagrant provided) VirtualBox, create a file
.env
in the project directory if it doesn't exist and add to itCHOKIDAR_USEPOLLING=true
. This ensures that the next time you startnpm start
, the observer will use polling mode as needed inside the virtual machine.If none of these solutions helped, please post a comment in this thread .
Hope this helps!
source to share
if you are a Linux user I did one hands-on and got success.
when i write npm start
in Linux terminal.
I used that terminal launch code against the code npm start
, but the page didn't refresh.
if you want to refresh the page on every save, you must write the command on the Linux system terminal, not the editor.
source to share