Gulp watch error on fresh VM setup - EACCES errors [solved]

Hi, I’m getting this error on a fresh Vagrant VM setup with a new WP / Sage installation:

gulp watch

[16:26:46] Using gulpfile /var/www/clients/
[16:26:46] Starting 'watch'...
[16:26:46] Finished 'watch' after 234 ms
[BS] Proxying:
[BS] Access URLs:
       Local: http://localhost:3000
          UI: http://localhost:3001
 UI External:
    throw errnoException(err, 'spawn');
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at Object.exports.spawn (child_process.js:995:9)
    at module.exports (/var/www/clients/
    at (/var/www/clients/
    at Object.utils.openBrowser (/var/www/clients/
    at (/var/www/clients/
    at EventEmitter.emit (events.js:129:20)
    at /var/www/clients/
    at /var/www/clients/

node -v
npm -v

What OS are you running?

Is this not the same issue as Gulp watch issue - spawn EACCES ?

I’m not sure how Browsersync works running from a VM either. It sort of expects a web browser to be accessible, which when working from a VM without a GUI, would not have one available. That might be an issue…

So after a solid day of troubleshooting I have found out that this EACCES problem is being caused by node version 0.12.6.

I downgraded node to 0.12.0 (using NVM) and npm install compiled without any jpegtran / pngcrush / optipng errors, and gulp watch ran fine. This was all on a fresh Vagrant VM running just Ubuntu 14.04 + LAMP + Prerequisite tools for Sage development.

Just for the record - node -v = v0.12.0 & npm -v = 2.5.1

EDIT: Sadly this doesn’t solve the problem if the theme folder is in a shared location outside of the VM itself. I’m messing around with the Vagrantfile to see if I can apply the right permissions to the share folders, but I’m stumped as it was working as is when Roots 8.0 / Sage was first released :confounded: Anyway I should sleep on it…

Ok, finally got to the bottom of this and I’m posting the solution for everyone (including my future self that will probably try to search for this answer in a few months time!)

It turns out the permissions for the share / mounted folder in Vagrant were indeed the culprit, which is weird because they had worked fine beforehand up until a week or two ago. Anyway what I had in my vagrant file was:

#Point www subdirectory to /var/www/ on guest machine
  config.vm.synced_folder "www/", "/var/www", owner: "vagrant", group: "www-data", mount_options:     ["dmode=775,fmode=644"]

and I changed my file mode to 775:

#Point www subdirectory to /var/www/ on guest machine
  config.vm.synced_folder "www/", "/var/www", owner: "vagrant", group: "www-data", mount_options:     ["dmode=775,fmode=775"]

I realise this is not ideal for a publicly accessible site, but since my VM and its contents won’t be seen by anyone else except me, I can live with that. At least Gulp now happily watches my files in a mounted folder!

Also disregard my earlier comment about downgrading Node + NPM, I just tested everything on 0.12.6 + 1.12.

1 Like

Good lord.

After debugging, reinstalling and fiddling for 8 hours.

Thank you so much.

This is hidden wayyy too deep on Google.

I know what that feels like :wink: