webpack --watch构建一次后退出 [英] webpack --watch exits after building once
问题描述
我正在使用webpack --watch
语句以监视模式运行Webpack来构建我的ReactJS应用程序.但是由于某种原因,它现在停止工作.现在,它只编译一次代码并终止
I was using webpack --watch
statement to run my webpack in watch mode for building my ReactJS app. However for some reason, it stopped working now. It now just compiles the code once and terminates
我尝试了这篇SO文章中建议的方法: webpack --watch不是编译更改的文件
I tried the methods suggested in this SO post: webpack --watch isn't compiling changed files
但是,它并没有为我解决问题. 任何帮助
However it did not solve the problem for me. Any help is appreaciated
推荐答案
问题似乎是由于inotify监视限制所致
The problem seems to have arose because of the inotify watch limit
在Linux上,默认情况下,Listen使用inotify监视目录 变化.遇到数量限制的系统并不少见 您可以监视的文件数量.
Listen uses inotify by default on Linux to monitor directories for changes. It's not uncommon to encounter a system limit on the number of files you can monitor.
当前监视限制可以通过命令查看
The current watch limit can be seen through the command
$ cat /proc/sys/fs/inotify/max_user_watches
在我的情况下,这是8192,这是linux X64系统的默认值
In my case it was 8192 which is the default value for linux X64 systems
要临时更改它,我们需要运行以下命令
To change it temporarily we need to run the following commands
$ sudo sysctl fs.inotify.max_user_watches=524288
$ sudo sysctl -p
要进行永久设置,我们应该运行
For permanently setting it we should run run
$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -p
这篇关于webpack --watch构建一次后退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!