reactjslaravelvitelaravel-10

Error running server in laravel/react app


I am getting a error when a try to run the server on a laravel app, I used the starter kit with react like the tutorial in the docs


> dev
> vite


  VITE v5.4.10  ready in 1082 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

  LARAVEL v10.48.22  plugin v1.0.5

  ➜  APP_URL: http://localhost
node:internal/fs/watchers:247
    const error = new UVException({
                  ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/note/Área de trabalho/2024/Projects/kanban/laravel-kanban-v1/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php'
    at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
    at Object.watch (node:fs:2490:36)
    at createFsWatchInstance (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:42779:17)
    at setFsWatchListener (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:42826:15)
    at NodeFsHandler._watchWithNodeFs (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:42981:14)
    at NodeFsHandler._handleFile (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:43045:23)
    at NodeFsHandler._addToNodeFs (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:43287:21)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:44480:10)
    at NodeFsHandler._addToNodeFs (file:///home/note/%C3%81rea%20de%20trabalho/2024/Projects/kanban/laravel-kanban-v1/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:43295:18) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/home/note/Área de trabalho/2024/Projects/kanban/laravel-kanban-v1/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php',
  filename: '/home/note/Área de trabalho/2024/Projects/kanban/laravel-kanban-v1/vendor/league/commonmark/src/Extension/ConfigurableExtensionInterface.php'
}

Node.js v20.18.0

I am using Ubuntu 23.04

laravel 10

I reinstalled the package but I keep getting the same error, I deleted the node_modules but it didn't work either


Solution

  • The error ENOSPC: System limit for number of file watchers reached occurs when the system hits the maximum limit of files that can be watched by the system. This is a system-level limitation, not a Laravel or Node.js issue.

    Check your current inotify watch limit and increase the limit:

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

    This will increase the file watch limit to 524288, which should be enough for most development environments.

    If you want to make this change permanent (survive reboots), you can create a new configuration file:

    sudo touch /etc/sysctl.d/40-max-user-watches.conf
    echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.d/40-max-user-watches.conf
    

    After applying these changes, try running your development server again.