Without making any changes on the webpack config, webpack wants to watch all parent directories, up to the root directory.
So it causes the error: EMFILE: too many open files, watch '/'
Did anybody have the same problem, or does anbody have an idea how I can find the reason or does anybody know a solution?
The Webpack config is:
const path = require('path');
module.exports = {
entry: './src/index.js',
watch: true,
watchOptions: {
ignored: '/node_modules/',
},
output: {
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.js$/,
exclude: '/node_modules/',
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.less$/i,
use: [
// compiles Less to CSS
'style-loader',
'css-loader',
'less-loader',
]
}
],
}
}
I faced them same issue, multiple times. Reboot works but is tedious. This post here points so another solution.
Checking cat /proc/sys/fs/inotify/max_user_instances (mine was 128) and increase the value.
Can be done with:
sudo sysctl fs.inotify.max_user_instances=256
This worked instantly.
Too survive a reboot the value must go to
/etc/sysctl.conf
see https://www.suse.com/support/kb/doc/?id=000020048
It's been a system problem. After rebooting, it worked again as usual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With