Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt build fails in travis - "Cannot find any-promise implementation"

I'm using travis to test my code. Recently the grunt tasks have started to fail without no change being made to anything involved with grunt. (The new commit which is tested contains just very minor changes in two PHP files.) Here is the part of log from travis:

$ grunt build:app
Running "typings:default" (typings) task
Warning: Cannot find any-promise implementation nor global.Promise. You must   install polyfill or call require("any-promise/register") with your preferred implementation, e.g. require("any-promise/register")("bluebird") on application load prior to any require("any-promise"). Use --force to continue.
Aborted due to warnings.
The command "grunt build:app" exited with 3.

I tried to search for that warning message but couldn't find anything useful.

One more thing: When I run grunt build:app locally on my pc it works just fine.

Thanks for your time :)

like image 492
Tony Vlcek Avatar asked Mar 20 '16 11:03

Tony Vlcek


2 Answers

I had the same problem when I started using grunt-typings. Worked locally and didn't work on my CI server. Ended up fixing it by doing what the error message suggests:

npm install bluebird

npm install any-promise

In GruntFile.js:

require("any-promise/register")("bluebird");

like image 197
Mike Bell Avatar answered Oct 15 '22 18:10

Mike Bell


Update your node.js version to >v0.12. To check your version of node.js use node -v. The documentation of any-promise explains:

Node.js versions prior to v0.12 may have contained buggy versions of the global Promise. For this reason, the global Promise is not loaded automatically for these old versions. If using any-promise in Node.js versions versions <= v0.12, the user should register a desired implementation.

like image 3
Benedikt Köppel Avatar answered Oct 15 '22 17:10

Benedikt Köppel