I try to make a gulp compile my sass then autoprefixit with gulp-autoprefixer
but i'm getting an error.
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('test', function(){
gulp.src('_sass/main.sass')
.pipe(sass())
.pipe(autoprefixer())
.pipe(gulp.dest('./assets/css'));
});
I'm trying to run this Gulpfile.js
and i'm using :
"gulp": "~3.9.0",
"gulp-sass": "~2.0.4",
"gulp-autoprefixer": "~3.0.1",
and NPM version 1.3.10
When i run gulp test
i get this :
/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:152
this.processing = new Promise(function (resolve, reject) {
^
ReferenceError: Promise is not defined
at LazyResult.async (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:152:31)
at LazyResult.then (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:75:21)
at DestroyableTransform._transform (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/index.js:28:13)
at DestroyableTransform.Transform._read (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
at doWrite (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
at writeOrBuffer (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:312:5)
at DestroyableTransform.Writable.write (/home/matei/Tests/test-4/node_modules/gulp-autoprefixer/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:239:11)
at write (/home/matei/Tests/test-4/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/home/matei/Tests/test-4/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
I don't really know what i'm doing wrong. Is not working when i use sass or plain css. I think is something with my files.
Had the same issue. For me, updating node didn't work but adding this at the very beginning of my gulpfile did:
This does not answer the question directly but it might be useful for people that get this error when trying to run the ionic 2 tutorial.
As pointed by other answers the problem is that
es6-promise
is missing.I got the same error when trying to start the ionic 2 tutorial (https://github.com/driftyco/ionic2-starter-tutorial): (my ionic 2 version is 2.0.0-beta.25 and latest tutorial commit is ed9ef2fcce887e4d1c08c375c849b06b8394bad7)
This is the stack trace I got when trying to run the app with
ionic serve
:Again, as pointed by other answers, this is how to solve this:
edit gulpfile.js and add in line 6:
require('es6-promise').polyfill();
install the missing dependency with:
npm install es6-promise --save
After this changes, the problem was fixed and I was able to start the local server.
Install es6-promise in ur project location where package.json exists
Then make the first line of your gulpfile.js be the following code:
I updated node.js to the latest version using :
for my Ubuntu machine, as shown here.
After that i updated NPM using :
As shown here.
Now the
gulp-autoprefixer
start working but i got an error fromgulp-sass
. I updated it using this instruction :Found here.Now i have
"gulp-sass": "^2.0.4"
and this fixed all my problems.Thanks for advice and help.