我正在开发一个 Laravel 项目,因此不直接使用 Webpack 而是使用 Mix,最近我遇到了ENOSPC: System limit for number of file watchers reached
错误。
上网查了一下,发现Webpack/Mix默认是不会忽略node_modules
目录的(为什么?),所以决定把它加入忽略列表。
查看 Laravel Mix文档和 Webpack文档,我将我的更新webpack.mix.js
如下:
mix
.webpackConfig({
watchOptions: {
ignored: /node_modules/, /* just taken from webpack docs */
}
})
但这只是从目录中移动了错误node_modules
,resources/images
因此尝试以多种方式添加它,但仍然在图像文件上出现错误:
mix
.webpackConfig({
watchOptions: {
ignored: '/resources/images', /* not working */
ignored: './resources/images', /* not working */
ignored: '**/resources/images', /* not working */
ignored: /resources/, /* not working */
}
})
错误:
(node:2013879) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch 'resources/images'
⋮
(node:2013879) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch 'resources/images/logo_vector.svg'
⋮
(node:2013879) UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch 'resources/images/icon.jpg'
⋮
我错过了什么?