Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
809 views
in Technique[技术] by (71.8m points)

linux - webpack --watch exits after building once

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem seems to have arose because of the inotify watch limit

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...