Watchpack Error (watcher): Error: EMFILE: too many open files, watch '/'

Viewed 257

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',
                ]
            }
        ],
    }
}
1 Answers

It's been a system problem. After rebooting, it worked again as usual.

Related