E
E
Emptyform2016-04-25 19:01:58
css
Emptyform, 2016-04-25 19:01:58

Gulp is a bug with postscc when compiling sass. What is the problem?

There is an extremely simplified gulpfile.js

'use strict';

var gulp = require('gulp'),
    rename = require('gulp-rename'),
    sass = require('gulp-sass'),
    csscomb = require('gulp-csscomb'),
    minifyCss = require('gulp-minify-css'),
    postcss = require('gulp-postcss'),
    autoprefixer = require('autoprefixer');


gulp.task('sass', function () {
    gulp.src('src/sass/style.scss')
        .pipe(sass())
        .pipe(sass().on('error', sass.logError))
        //.pipe(postcss([autoprefixer({browsers: ['last 3 versions']})]))
        .pipe(csscomb())
        .pipe(gulp.dest('build/css'))
        .pipe(minifyCss({compatibility: 'ie8'}))
        .pipe(rename('style.min.css'))
        .pipe(gulp.dest('build/css/'))
    ;
});

As such, it compiles SASS to CSS just fine. But it is worth uncommenting the line with POSTSCC and then the error occurs:
>gulp sass
[18:50:09] Using gulpfile C:\_git\Treehouse\gulpfile.js
[18:50:09] Starting 'sass'...
[18:50:09] Finished 'sass' after 8.7 ms

C:\_git\Treehouse\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:157
        this.processing = new Promise(function (resolve, reject) {
                              ^
ReferenceError: Promise is not defined
    at LazyResult.async (C:\_git\Treehouse\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:157:31)
    at LazyResult.then (C:\_git\Treehouse\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:79:21)
    at Transform.stream._transform (C:\_git\Treehouse\node_modules\gulp-postcss\index.js:49:8)
    at Transform._read (_stream_transform.js:179:10)
    at Transform._write (_stream_transform.js:167:12)
    at doWrite (_stream_writable.js:226:10)
    at writeOrBuffer (_stream_writable.js:216:5)
    at Transform.Writable.write (_stream_writable.js:183:11)
    at DestroyableTransform.ondata (C:\_git\Treehouse\node_modules\gulp-sass\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:531:20)
    at DestroyableTransform.EventEmitter.emit (events.js:95:17)

I reinstalled both postcss and autoprefixer - it did not help.
What is the problem and how to overcome it??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rikcon, 2016-04-25
@Emptyform

Update node.js you seem to have a very old version without promises.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question