Search code examples
laravelgulplaravel-elixirrun-sequence

running gulp inside a Laravel project fails when mixing styles and/or compiling sass files


Everything was working and i was capable to run gulp and gulp watch normally, after some changes in my phpspec files it dosn't work anymore. See the details below.

This is my gulpfile.js

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

elixir(function (mix) {

    mix.phpUnit().phpSpec();

    // this task should look for files inside the resources/assets/sass
    // folder.
    mix.sass(
        [
            './resources/assets/bower/bootstrap-sass/assets/stylesheets/_bootstrap.scss',
            '**',
        ],
        'resources/assets/css/sass.css'
    );

    // this task should look for files inside the resources/assets/css
    // folder.
    mix.styles(
        [
            '**',
        ],
        'public/css/all.css'
    );

    // this task should look for files inside the resources/assets/js
    // folder.
    mix.scripts(
        [
            './resources/assets/bower/jquery/dist/jquery.js',
            './resources/assets/bower/bootstrap-sass/assets/javascripts/bootstrap.js',
            '**',
        ],
        'public/js/app.js'
    );

    mix.version(
        [
            "css/all.css",
            "js/app.js",
        ]
    );

    mix.browserSync(
        {
            proxy: "localhost:8000",
        }
    );
});

And this is the output after runing gulp:

[19:00:44] Using gulpfile ~/Public/forsale/gulpfile.js
[19:00:44] Starting 'default'...
[19:00:44] Starting 'PHPUnit'...

Triggering PHPUnit: vendor/bin/phpunit --verbose
[19:00:44] Finished 'default' after 44 ms
PHPUnit 4.8.26 by Sebastian Bergmann and contributors.

Runtime:    PHP 7.0.4-7ubuntu2.1
Configuration:  /home/rafael/Public/forsale/phpunit.xml

.

Time: 49 ms, Memory: 8.00MB

OK (1 test, 1 assertion)
[19:00:44] gulp-notify: [Green!] Your PHPUnit tests passed!
[19:00:44] Finished 'PHPUnit' after 144 ms
[19:00:44] Starting 'PHPSpec'...

Triggering PHPSpec: vendor/bin/phpspec run
/  skipped: 0%  /  pending: 0%  / passed: 100%  /  failed: 0%   /  broken: 0%   /  2 examples
1 specs
2 examples (2 passed)
5ms

[19:00:44] gulp-notify: [Green!] Your PHPSpec tests passed!
[19:00:44] Finished 'PHPSpec' after 84 ms
[19:00:44] Starting 'sass'...

Fetching Sass Source Files...
   - ./resources/assets/bower/bootstrap-sass/assets/stylesheets/_bootstrap.scss


Saving To...
   - resources/assets/css/sass.css

[19:00:44] 'sass' errored after 104 ms
[19:00:44] Error: Cannot find module './flex-Spec'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/rafael/Public/forsale/node_modules/autoprefixer-core/lib/hacks/flex.js:6:14)
    at Object.<anonymous> (/home/rafael/Public/forsale/node_modules/autoprefixer-core/lib/hacks/flex.js:58:4)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
[19:00:44] Error in plugin 'run-sequence(sass)'
Message:
    sass catch

It seems that run-sequence has a missing module, but i didn't find it.


Solution

  • The problem was solved, i removed my node_modules folder and applied npm install && npm update again. It looks like one of my libraries were damaged and i don't know why.