I know this is an old question, but I spent a couple of days looking through solutions which didn't work for me so maybe this helps someone else.
My project had a plugin which was throwing an error. I had to remove the plugin and add it again, and suddenly I could make it through the build process.
$ cordova add phonegap-plugin-push
$ cordova plugin add phonegap-plugin-push
I just ran the above and it was solved.