question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Laravel Mix Browser Sync stopped working on Linux Mint

See original GitHub issue

This problem is occurring on a fresh install. However, I have run the suggested commands (reinstall node/check for elixir etc.) anyway.

  • Laravel Mix Version: 1.4.5
  • Node Version: 8.6.0
  • NPM Version: 5.4.2
  • OS: Linux Mint 18 Cinnamon 64-bit
  • browser-sync@2.18.13
  • browser-sync-webpack-plugin@1.2.0

Description:

When running ‘npm run watch’ the following error is returned:

events.js:182 throw er; // Unhandled ‘error’ event ^

Error: watch app ENOSPC at _errnoException (util.js:1019:11) at FSWatcher.start (fs.js:1383:19) at Object.fs.watch (fs.js:1409:11) at createFsWatchInstance (/home/simon/Code/exp/testWatch/node_modules/chokidar/lib/nodefs-handler.js:37:15) at setFsWatchListener (/home/simon/Code/exp/testWatch/node_modules/chokidar/lib/nodefs-handler.js:80:15) at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/simon/Code/exp/testWatch/node_modules/chokidar/lib/nodefs-handler.js:228:14) at FSWatcher.NodeFsHandler._handleDir (/home/simon/Code/exp/testWatch/node_modules/chokidar/lib/nodefs-handler.js:407:19) at FSWatcher.<anonymous> (/home/simon/Code/exp/testWatch/node_modules/chokidar/lib/nodefs-handler.js:455:19) at FSWatcher.<anonymous> (/home/simon/Code/exp/testWatch/node_modules/chokidar/lib/nodefs-handler.js:460:16) at FSReqWrap.oncomplete (fs.js:154:5) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ watch: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ watch script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/simon/.npm/_logs/2017-09-30T22_19_30_813Z-debug.log

Steps To Reproduce:

Install a new Laravel app using ‘laravel new <project-name>’ Run ‘npm install’

Add:

mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css')
   .browserSync('thephysics.dev');

to webpack.mix.js.

Run ‘npm run watch’ (install extra dependencies the first time) Run ‘npm run watch’ again - see the error described above.


This was working fine last week. It didn’t work on a new project tonight. Having upgraded npm and node it now doesn’t work on any projects (even after reinstalling all node dependencies).

Help!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
simonhuntcommented, Oct 10, 2017

Thanks again @Ruchern - really grateful for your time.

I’ve actually reinstalled Linux Mint in an attempt to solve this thread since and set the swapfile to nearly 15 Gb (twice my RAM). This didn’t work, but I have literally just posted something which did fix it.

It appears to be something to do with the default number of files which can be watched. By increasing that number the process works now.

1reaction
simonhuntcommented, Oct 10, 2017

The solution to this seems to be to increase the number of ‘watches’ the linux system can handle by running this command:

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

This comes from the following Stack Overflow thread:

https://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc

It doesn’t explain why the problem is only with VS Code (other than assuming that VS code uses a lot of ‘watches’).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel Mix Browser Sync stopped working on Linux Mint #1230
This problem is occurring on a fresh install. However, I have run the suggested commands (reinstall node/check for elixir etc.) anyway.
Read more >
Laravel-Mix + BrowserSync Not Loading at localhost:3000
If I run php artisan serve , localhost:8000 loads up fine, but of course, it's not connected with BrowserSync . My webpack.mix.js file...
Read more >
error at installation of browser-sync in mint 19.1
Hello! i try to install browser-sync( https://www.browsersync.io) on mint 19.1. But i get an error. The only machine i succed to install ...
Read more >
"npm run watch-poll" freezes the terminal after a random ...
I'm using Browsersync and webpack and after a while of usage, the terminal completely freezes. Can't type anymore in it even when opening...
Read more >
Browsersync - Time-saving synchronised browser testing
Browsersync makes your browser testing workflow faster by synchronising URLs, interactions and code changes across multiple devices.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found