postcss-nested: ReferenceError: Promise is not defined

Just trying out PostCSS and right out the gate bumped into an issue im not sure why.

Whenever I change the CSS file, with postcss-nested enabled, i get:

/Users/luismartins/Sites/LAB/postcss/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:152
        this.processing = new Promise(function (resolve, reject) {
                              ^
ReferenceError: Promise is not defined
    at LazyResult.async (/Users/luismartins/Sites/LAB/postcss/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:152:31)
    at LazyResult.then (/Users/luismartins/Sites/LAB/postcss/node_modules/gulp-postcss/node_modules/postcss/lib/lazy-result.js:75:21)
    at Transform.stream._transform (/Users/luismartins/Sites/LAB/postcss/node_modules/gulp-postcss/index.js:45: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 write (/Users/luismartins/Sites/LAB/postcss/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/Users/luismartins/Sites/LAB/postcss/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)

My gulpfile.js is pretty vanilla atm:

var gulp = require('gulp');
var nestedcss = require('postcss-nested');
    // browserSync = require('browser-sync'),
    // reload      = browserSync.reload;


gulp.task('css', function () {
    var postcss = require('gulp-postcss');
    var processors = [
        nestedcss
    ];
    return gulp.src('src/**/*.css')
        .pipe( postcss( processors ) )
        .pipe( gulp.dest('build/') );
});



// Watch
gulp.task('default', function() {

    gulp.watch('src/**/*.css', ['css']);

});

The css file only has a standard css declaration in it.

Any tips?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@lmartins You can update node.js to 0.12 or install and call before all postcss requires

require('es6-promise').polyfill();