简体   繁体   English

create-react-app 的本地服务器自动刷新在我的虚拟机中不起作用

[英]Local Server Auto Refresh of create-react-app is not working in my VM

Local Server Auto Refresh of create-react-app is not working in my Virtual Machine: When I update my code, the server is not auto updating. create-react-app 的本地服务器自动刷新在我的虚拟机中不起作用:当我更新我的代码时,服务器不会自动更新。

I'm using Ubuntu as OS and VSCode to write code and the VSCode terminal to run the app locally.我使用 Ubuntu 作为操作系统和 VSCode 来编写代码,并使用 VSCode 终端在本地运行应用程序。

The command to local startup: npm start本地启动命令: npm start

I created an.env and add CHOKIDAR_USEPOLLING=true to it.我创建了 an.env 并将 CHOKIDAR_USEPOLLING=true 添加到其中。 Why?为什么? This ensures that the next time of run npm start, the watcher uses the polling mode, as necessary inside a VM.这确保了下次运行 npm 启动时,观察者使用轮询模式,必要时在 VM 内部。

Got this from here: Development server of create-react-app does not auto refresh从这里得到这个: create-react-app 的开发服务器不会自动刷新

And up the answer.和答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM