Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

toddvalentine's avatar

Elixir node-sass error on Homestead

I am using Elixir and get the following error when I attempt to run gulp on the Ubuntu Homestead machine:

Error: libsass bindings not found. Try reinstalling node-sass? at getBinding (/home/vagrant/code/www.thedeadweather.com/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:21:11) at Object. (/home/vagrant/code/www.thedeadweather.com/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:211:23) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/home/vagrant/code/www.thedeadweather.com/node_modules/laravel-elixir/node_modules/gulp-sass/index.js:3:17) at Module._compile (module.js:456:26)

I have run npm install andI can successfully gulp from my local machine, This error only occurs when I gulp on Homestead. Node-sass is installed in the gulp-sass node_modules directory

0 likes
12 replies
JtKese's avatar

Had this same problem, running homestead on a Windows host. The same project cloned on an Ubuntu host produced no problems, it may be a side-effect of having to use npm install --no-bin-links for the local node packages stored in my project directory on NTFS.

I got gulp running again by installing node-sass and copying its vendor directory into ./node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node_sass

1 like
Shane's avatar

(Hi, I'm new)

@JtKese, would you mind clarifying your last line there where you got gulp to work? Where did you install node-sass before copying it's vendor directory?

I've just run into this problem too while trying to get my head around probably too many things at once (SASS, gulp, elixir, node). I'm a bit out of my depth trying to deal with the node/windows problems that seem to be common. Here's a summary of where I have got to with this:

  • Homestead (antoniofrignani/laravel-homestead-settler-32 version) on Windows 7.
  • new laravel 5 project at /home/vagrant/Code/dv5
  • In the project directory I created a node_modules directory
  • copied the package.json file to /usr/local/npm/dv5 and symlinked the node_modules directory to this directory also
  • sudo npm install in /usr/local/npm/dv5 seemed to work, stuff was installed into the node_modules dir and available in the shared directory
  • bower install materialize also seemed to work
  • I added mix.sass(["materialize.sass"]); to gulpfile.js
  • ran gulp
  • Error: libsass bindings not found. Try reinstalling node-sass
  • sudo npm install node-sass (in usr/local/npm/dv5) seemed to install node-sass but I still get the libsass error.

Thanks, I hope this makes sense!

Shane

JtKese's avatar

Hi!

Installing node-sass is just the quickest way I found to acquire the necessary files, but by itself installing the module doesn't fix the issue. We are just harvesting from what the installation brings in.

You need to move

    node_modules/node-sass/vendor

to

    node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node_sass/vendor

After you're done doing this, you can delete the top-level node_modules/node-sass.

For whatever reason, the copy of node-sass within laravel-elixir is missing the vendor folder when installed, and we have to put it back. But then it works.

5 likes
Shane's avatar

Cool, thanks for that, seems to have done the trick :-)

bashy's avatar

Found this myself when installing the packages via local then trying gulp on VM. Works fine if you install them on the VM but then it won't work on local :')

Shane's avatar

When I run gulp now everything looks as if it runs ok but nothing is compiled to the public directory. I wonder if this is something to do with the node/windows thing again or if (more likely) I'm doing it wrong. I tried a simple example first to mix two css files as is demonstrated in the https://laracasts.com/series/whats-new-in-laravel-5/episodes/10

Here is gulpfile i tried for that:

elixir(function(mix) {
    mix.styles([
        'public/css/one.css',
        'public/css/two.css'
     ])
});

I no longer have the info gulp printed out for that however it looked like it was working but there was no new all.css in public like happened in the video.

Then I tried this tutorial on Laravel News for setting up Bootstrap: https://laravel-news.com/2014/10/setting-laravel-elixr-bootstrap/

Here is the gulp file for that:

var paths = {
    'jquery': './vendor/bower_components/jquery/',
    'bootstrap': './vendor/bower_components/bootstrap-sass-official/assets/'
}

elixir(function(mix) {
    mix.sass("style.scss", 'public/css/', {includePaths: [paths.bootstrap + 'stylesheets/']})
        .copy(paths.bootstrap + 'fonts/bootstrap/**', 'public/fonts')
        .scripts([
            paths.jquery + "dist/jquery.js",
            paths.bootstrap + "javascripts/bootstrap.js"
         ], './', 'public/js/app.js');
});

and here is the output from gulp:

 vagrant@homestead:~/Code/dv5$ gulp
 [21:30:57] Using gulpfile ~/Code/dv5/gulpfile.js
 [21:30:57] Starting 'default'...
 [21:30:57] Starting 'sass'...
 [21:31:00] Finished 'default' after 2.34 s
 [21:31:00] Finished 'sass' after 2.35 s
 [21:31:00] Starting 'copy'...
 [21:31:00] Finished 'copy' after 6.51 ms
 [21:31:00] Starting 'scripts'...
 [21:31:00] Finished 'scripts' after 172 ms

The copy seems to work ok but not the sass or scripts bits. There is no style.scss file in the bootstrap directory - I don't know if I'm supposed to put one there or not...

JtKese's avatar

If it doesn't find the files you specify, it fails silently and you see a super-short duration (like 172 ms). After a bit of trial and error, I found that in my case it worked with the following:

scripts(['../../resources/assets/js/script.js'], 'public/js/script.js')

I'm running gulp on my project's base directory with gulpfile.js, resources/, and public/ all existing at this same level (standard configuration for L5).

I'm thinking that the "scripts" command processes the source location relative to ./node_modules/laravel-elixir, but I could be mistaken.

1 like
curtdp's avatar

Hello. I had the same problem, my solution was to delete project's ./node_modules directory and run npm install again.

node -v
v0.12.0
rm -rf node_modules/
npm install

Please or to participate in this conversation.