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.

Problem with `npm run watch` in a Homestead box on Windows 10

See original GitHub issue
  • Laravel Mix Version: 0.11.4
  • Node Version: 7.10.0
  • NPM Version: 4.2.0
  • OS: Windows 10
  • Homestead: 2.1.0

Description:

I’ve just started using Homestead and I got the VM up and running, but I’m having trouble using Laravel Mix. I can execute prod and dev successfully, but watch throws this error:

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: watch public/wp-app/themes/spiral/node_modules/depd/lib/compat ENOSPC
    at exports._errnoException (util.js:1050:11)
    at FSWatcher.start (fs.js:1398:19)
    at Object.fs.watch (fs.js:1424:11)
    at createFsWatchInstance (/home/vagrant/Code/senzafine/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/vagrant/Code/senzafine/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/vagrant/Code/senzafine/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/vagrant/Code/senzafine/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/vagrant/Code/senzafine/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/vagrant/Code/senzafine/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at FSReqWrap.oncomplete (fs.js:114:15)

npm ERR! Linux 4.4.0-66-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "watch"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
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 '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! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     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! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/.npm/_logs/2017-05-06T14_20_27_926Z-debug.log
vagrant@homestead:~/Code/senzafine$ exit
logout
Connection to 127.0.0.1 closed.

Steps To Reproduce:

My package.json scripts are this:

"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "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 run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },

My webpack.mix.js is setup to use BrowserSync like so:

const BrowserSyncPlugin = require('browser-sync-webpack-plugin')

mix.webpackConfig({
    plugins: [
        new BrowserSyncPlugin(
            {
                files: [
                    './**/*.css',
                    'resources/views/**/*.php'
                ]
            },
            {
                reload: false,
                open: false
            }
        )
    ]
})

I tried running watch removing BrowserSync from the config, but I got the same problem.

One last thing, since I’m new at this and couldn’t find any info anywhere, if I get watch to run can I open browser on my host machine to watch the changes or does it need to be on the VM?

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
YahzeeSkellingtoncommented, May 7, 2017

I finally got it working putting this on my webpack.mix.js file and running watch-poll

mix.webpackConfig({
   plugins: [
      new BrowserSyncPlugin(
         {
            host: '192.168.10.10',
            port: 3000,
            proxy: 'http://senzafine.app',
            files: [
               './**/*.css',
               './app/**/*',
               './config/**/*',
               './resources/views/**/*',
               './routes/**/*'
            ],
            watchOptions: {
              usePolling: true,
              interval: 500
            },
            open: false
         },
         {
            reload: false
         }
      )
   ]
})
1reaction
ruchernchongcommented, May 6, 2017

I just saw thisENOSPC. ENOSPC = No space on hard drive.

http://stackoverflow.com/a/22476114/4031163

Check your Homestead available disk space.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with npm run watch in a Homestead box on Windows ...
You are running BrowserSync in Homestead, so the watch command is trying to launch a browser in your Homestead. However, Homestead is a...
Read more >
NPM run watch on vagrant homestead - Laracasts
I'm running laravel through vagrant homestead on windows 10. I'm trying to install moment.js and get that working, but I'm getting the "moment...
Read more >
Error (es2015 not found) running "npm run dev" on a laravel ...
Struggling with Laravel 5.4 vagrant box on Windows 10, trying to get laravel-mix to work. My end goal is to set up a...
Read more >
学习Laravel —— 前端篇(持续更新) - LearnKu
求win 10 Homestead 环境搭建到编译教程。 我被环境折磨了很久很久了,至今环境还没搭建好。网上的教程我也试过,但结果总是失败。
Read more >
How To Run 'Npm Install' On Vagrant Homestead - ADocLib
Use the following steps to install the mssqltools on Ubuntu. To do that issue the command sudo aptget install y mssqlserver. you can't...
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