首页 > 解决方案 > Browsersync Laravel mix, Error: watch ENOSPC throw er; 未处理的“错误”事件

问题描述

当我npm run watch-poll在 Laravel 中使用 browsersync 功能运行时:

mix.browserSync('https://vuravel.local')

我收到了这个奇怪的错误。我不知道如何解决这个问题。有任何想法吗?

我在 Ubuntu 上使用 Google Chrome 作为浏览器运行 apache 服务器。

[Browsersync] Access URLs:
 ---------------------------------------
 Local: https://localhost:3000
 External: https://192.168.1.244:3000
 ---------------------------------------
 UI: http://localhost:3001
 UI External: http://localhost:3001
 ---------------------------------------
 [Browsersync] Watching files...
events.js:183
  throw er; // Unhandled 'error' event
  ^

 Error: watch /path/to/root/***.php ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)

在此处输入图像描述

标签: webpackbrowser-synclaravel-mix

解决方案


ENOSPC 是“没有可用空间错误”。

您需要做的是通过在终端中运行以下命令来增加可以观看的最大文件数量:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

推荐阅读