Troubleshooting
npm start
doesnât detect changesâ
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:
- Check that your file is imported by your entrypoint. TypeScript will show errors on any of your source files, but webpack only reloads your files if they are directly or indirectly imported by one of your entrypoints.
- 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 âAdjusting Your Text Editorâ.
- 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 addCHOKIDAR_USEPOLLING=true
to it. This ensures that the next time you runnpm 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.
npm start
fail due to watch errorâ
If you are using a Linux operating system and see an error similar to: ENOSPC: System limit for number of file watchers reached
, you can fix the issue by increasing the fs.inotify.max_user_watches
setting of your operating system.
If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
If you are running ArchLinux, run the following command instead:
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
Then paste it in your terminal and press on enter to run it. You could find more information here.
npm test
hangs or crashes on macOS Sierraâ
If you run npm test
and the console gets stuck after printing react-scripts test
to the console there might be a problem with your Watchman installation as described in facebook/create-react-app#713.
We recommend deleting node_modules
in your project and running npm install
(or yarn
if you use it) first. If it doesn't help, you can try one of the numerous workarounds mentioned in these issues: