sindresorhus / gulp-autoprefixer

Prefix CSS
MIT License
694 stars 50 forks source link

Promise is not defined error after running autoprefix task on CentOS 7 #58

Closed crmpicco closed 8 years ago

crmpicco commented 8 years ago

I have a CentOS 7 box and I have just installed the autoprefixer Gulp task. I am using NPM v3.5.3 and NodeJS v0.10.30 and when I run gulp at the CLI I get the following error:

[vagrant@crmpicco /var/www/crmpicco]# gulp
[17:49:01] Using gulpfile /var/www/rels/20150805093500/gulpfile.js
[17:49:01] Starting 'default'...
[17:49:01] Starting 'styles'...
[17:49:01] Finished 'default' after 24 ms
[17:49:05] Finished 'styles' after 3.87 s
[17:49:05] Starting 'autoprefix'...

/var/www/rels/20150805093500/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:157
        this.processing = new Promise(function (resolve, reject) {
                              ^
ReferenceError: Promise is not defined

autoprefixer.coffee:

config = require('../config')
gulp = require('gulp')
autoprefixer = require('gulp-autoprefixer')

gulp.task 'autoprefix', ->
  gulp.src(config.basePath.src + config.files.maincss)
    .pipe(autoprefixer({
      browsers: ['last 2 versions']
    }))
    .pipe(gulp.dest(config.basePath.src + config.filePath.css))

default.coffee:

gulp = require('gulp')
runSequence = require('run-sequence')

### Gulp task ###
gulp.task 'default', ->
  runSequence('styles', 'autoprefix', 'coffee', 'fonts', 'watch')

Do I need to upgrade NodeJS (or NPM)? The answer given here - http://stackoverflow.com/a/32940141/691505 - to require es6-promise does not work for me.

sindresorhus commented 8 years ago

Upgrade Node.js. And please start looking at closed issues before posting. Yours is the nth duplicate...

crmpicco commented 8 years ago

You're right, I'm here all the time.

crmpicco commented 8 years ago

FWIW, On CentOS 7 you can do the following:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (should show updated version now)
npm rebuild node-sass (Optional: if you use this)
bringking commented 8 years ago

We are still seeing this error on CentOS 6.7 using Node 5.4.1, which has native Promises I thought..