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

geeksareforlife's avatar

Can't get Elixir/Gulp to work on fresh install

Hi

We have a fresh install of Laravel, inside a Debian VM. Everything else works, but we are unable to get Elixer/Gulp working.

The commands we execute (inside the VM) are:

apt-get install curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
apt-get install -y nodejs
cd /vagrant
npm install --global gulp-cli
npm install --no-bin-links

And then we run "gulp" (we haven't touched the gulpfile at this point), but we get errors:

[15:28:20] Using gulpfile /vagrant/gulpfile.js
[15:28:20] Starting 'all'...
[15:28:20] Starting 'sass'...
[15:28:21] 'sass' errored after 1.16 s
[15:28:21] SyntaxError: /vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/node_modules/caniuse-db/features-json/transforms2d.json: Unexpected token 
    at Object.parse (native)
    at Object.Module._extensions..json (module.js:424:27)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/data/prefixes.js:109:11)
    at Object.<anonymous> (/vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/data/prefixes.js:593:4)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
[15:28:21] 'all' errored after 1.17 s
[15:28:21] SyntaxError in plugin 'run-sequence(sass)'
Message:
    /vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/node_modules/caniuse-db/features-json/transforms2d.json: Unexpected token 
Stack:
SyntaxError: /vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/node_modules/caniuse-db/features-json/transforms2d.json: Unexpected token 
    at Object.parse (native)
    at Object.Module._extensions..json (module.js:424:27)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/data/prefixes.js:109:11)
    at Object.<anonymous> (/vagrant/node_modules/laravel-elixir/node_modules/gulp-autoprefixer/node_modules/autoprefixer/data/prefixes.js:593:4)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

I've been banging my head against a wall for days with this, so any help would be appreciated!

Thanks

James

0 likes
6 replies
ejdelmonico's avatar

ok, isn't the --no-bin-links option for windows installs? If I read you correctly, you installed on a Linux VM. Also, post your gulpfile.

geeksareforlife's avatar

Hi ejdelmonico

I believe it is to do with not generating symlinks, and vagrant boxes have trouble with those too. I did try it without that flag and got other, completely different errors!

my gulpfile is the one that came as default:

const elixir = require('laravel-elixir');

//require('laravel-elixir-vue');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(mix => {
    mix.sass('app.scss')
       .webpack('app.js');
});

Thanks

James

ejdelmonico's avatar

So I am in the loop, you have a Debian VM with a fresh install of Laravel 5.3 and you ran pm install after making sure you had curl, gulp-cli, etc installed globally? Node version?

ejdelmonico's avatar

Also, when things get flaky with npm packages, I usually delete the node_modules folder and do a 'npm install' again. It could be that autoprefixer did not install properly. Or, an older node version or npm version is the issue. It looks like you used node 4.0 and I think you need 5.6 or greater plus npm 3.6 or greater.

geeksareforlife's avatar

That is all correct, yep. I've also tried it with Node 4 and Node 6, both after doing a npm install npm@latest

J

Please or to participate in this conversation.