Laravel-mix - BrowserSync throwing an error at event.js:160

Published 2 weeks ago by tanmay_das

Not sure if the problem is related to laravel-mix, but I am having problem with Browsersync package. Here is my mix.js:


mix.js('resources/assets/js/app.js', 'public/js')
   .browserSync({proxy: 'localhost:8000'})
   .sass('resources/assets/sass/app.scss', 'public/css');

When I run npm run watch-poll ( watch doesn't pick up the changes, hence the watch-poll) I get the following error on the console:


[Browsersync] Watching files...
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: watch resources/views/auth/passwords ENOSPC
    at exports._errnoException (util.js:1020:11)
    at FSWatcher.start (fs.js:1443:19)
    at Object.fs.watch (fs.js:1470:11)
    at createFsWatchInstance (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at FSReqWrap.oncomplete (fs.js:123:15)
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 "--watch-poll"`
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/tanmay/.npm/_logs/2017-08-07T07_02_31_677Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch-poll: `npm run watch -- --watch-poll`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ watch-poll 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/tanmay/.npm/_logs/2017-08-07T07_02_31_725Z-debug.log

I am on: Ubuntu 16.04.3 (Not a VM) Using: Nodejs v6.11.2, NPM v5.3.0

UPDATE: This error doesn't occur on a new laravel project. To get the same result as a new project, this is what I did:

I removed the node modules: rm -rf node_modules I removed the package-lock.json file: rm package-lock.json I re-run: npm install, npm run dev, npm run watch-poll

Result: still same error :(

Here is my package.json file: https://pastebin.com/pLf4HHK3

tanmay_das

Thread updated...

36864
36864
2 weeks ago (12,680 XP)

ENOSPC means there's not enough space on the drive. Your /tmp/ directory is likely full.

This should help: https://stackoverflow.com/questions/22475849/node-js-error-enospc

tanmay_das

@36864 Thanks for your reply. But how can my /tmp directory be full? I installed the OS last night. If the directory is full, how is it that when I create a new laravel project and run the same mix.js file (I mean with browserSync() call), the npm commands run flawlessly? If a new project can pull in the browserSync() dependencies, why should an old project fail?

tanmay_das

Here is a screenshot of my /tmp directory: http://imgur.com/a/jqFjP

I can see a lot of npm-* folders in there... most of them are empty...

36864
36864
2 weeks ago (12,680 XP)

I'm not a linux expert, until just now I wasn't even aware /tmp/ could get full.

I do see a variety of solutions presented on the SO thread I linked though, and I'd be surprised if none of them manage to fix your issue.

tanmay_das

Strange but if I prefix the commands with sudo, then it works

Sign In or create a forum account to participate in this discussion.