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.

+18


source to share


5 answers


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 it CHOKIDAR_USEPOLLING=true

    . This ensures that the next time you start npm 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!

+20


source


Have you tried running npm as superuser? I had a problem with my project and I solved it like this.



$sudo bash
#npm  start

      

+15


source


If you are using Linux, check if it runs as root. If so, stop your server and disable enforcement (for more details, man selinux

).

sudo setenforce 0

      

Start your server again (no root), it may work.

0


source


I ran into this same issue when starting the server via npm run start

. When I changed it to npm start

, it worked as expected.

0


source


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.

-1


source







All Articles