Development server of create-react-app does not auto refresh

后端 未结 17 1458
清酒与你
清酒与你 2020-12-01 07:30

I am following a tutorial on React using create-react-app. The application is created by create-react-app v1.3.0

create-react-app my-app

T

相关标签:
17条回答
  • 2020-12-01 08:02

    Instead of

    npm start
    

    Run with administration permission in Linux

    sudo npm start
    
    0 讨论(0)
  • 2020-12-01 08:07

    Have you seen the “Troubleshooting” section of the User Guide?
    It describes a few common causes of this problem:

    When you save a file while npm start is running, the browser should refresh with the updated code.

    If this doesn’t happen, try one of the following workarounds:

    • If your project is in a Dropbox folder, try moving it out.
    • If the watcher doesn’t see a file called index.js and you’re referencing it by the folder name, you need to restart the watcher due to a Webpack bug.
    • Some editors like Vim and IntelliJ have a “safe write” feature that currently breaks the watcher. You will need to disable it. Follow the instructions in “Disabling swap files creation in vim”.
    • If your project path contains parentheses, try moving the project to a path without them. This is caused by a Webpack watcher bug.
    • On Linux and macOS, you might need to tweak system settings to allow more watchers.
    • If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an .env file in your project directory if it doesn’t exist, and add CHOKIDAR_USEPOLLING=true to it. This ensures that the next time you run npm start, the watcher uses the polling mode, as necessary inside a VM.

    If none of these solutions help please leave a comment in this thread.

    I hope this helps!

    0 讨论(0)
  • 2020-12-01 08:09

    Have you tried npm start with super user permissions? I had the issue with my project and I solved it like this.

    $sudo bash
    #npm  start
    
    0 讨论(0)
  • 2020-12-01 08:10

    If you are on linux, check if it works with root access. If it does, stop your server and disable enforcement (for more details, man selinux).

    sudo setenforce 0
    

    Start your server again (without root), it might work.

    0 讨论(0)
  • 2020-12-01 08:10

    push your commited changes to the branch and then delete the local repo folder then clone the repo again and run npm install or yarn install whichever you prefer. this workaround solved my issue

    0 讨论(0)
提交回复
热议问题