Thursday, December 31, 2015

ReferenceError: Promise is not defined on gulp build

While going thru getting started guide of polymer starter kit, I run into following issue -

> gulp
[15:12:04] Using gulpfile ~/Apps/js/polymer-playground/example/polymer-starter-kit-1.2.1/gulpfile.js
[15:12:04] Starting 'clean'...
[15:12:04] Finished 'clean' after 18 ms
[15:12:04] Starting 'default'...
[15:12:04] Starting 'copy'...
[15:12:04] Starting 'styles'...

/Users/UserName/Apps/js/polymer-playground/example/polymer-starter-kit-1.2.1/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:157
        this.processing = new Promise(function (resolve, reject) {
                              ^
ReferenceError: Promise is not defined

    at LazyResult.async (/Users/UserName/Apps/js/polymer-playground/example/polymer-starter-kit-1.2.1/node_modules/gulp-autoprefixer/node_modules/postcss/lib/lazy-result.js:157:31)

The issue is my node version, it needs to be 0.12.5 (it was 0.10.3)

Here are the steps to upgrade -
$ sudo npm cache clean -f
$ sudo npm install -g n
$ node -v
v0.10.35

It still says 0.10.35

Here is the way to switch between versions -

$ sudo n stable
$ node -v
v5.2.0

means Now we can move to 0.12.5 in easy steps -
$ sudo n 0.12.5
$ node -v
0.12.5

Now running gulp build works fine!

No comments:

Post a Comment