{"action":"created","issue":{"url":"https://api.github.com/repos/wbyoung/avn/issues/38","labels_url":"https://api.github.com/repos/wbyoung/avn/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/wbyoung/avn/issues/38/comments","events_url":"https://api.github.com/repos/wbyoung/avn/issues/38/events","html_url":"https://github.com/wbyoung/avn/issues/38","id":130521174,"number":38,"title":"reduce is not a function: avn should force mz to use bluebird as its Promise implementation","user":{"login":"mwolson","id":1510193,"avatar_url":"https://avatars.githubusercontent.com/u/1510193?v=3","gravatar_id":"","url":"https://api.github.com/users/mwolson","html_url":"https://github.com/mwolson","followers_url":"https://api.github.com/users/mwolson/followers","following_url":"https://api.github.com/users/mwolson/following{/other_user}","gists_url":"https://api.github.com/users/mwolson/gists{/gist_id}","starred_url":"https://api.github.com/users/mwolson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwolson/subscriptions","organizations_url":"https://api.github.com/users/mwolson/orgs","repos_url":"https://api.github.com/users/mwolson/repos","events_url":"https://api.github.com/users/mwolson/events{/privacy}","received_events_url":"https://api.github.com/users/mwolson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-01T23:43:44Z","updated_at":"2016-02-02T00:28:24Z","closed_at":null,"body":"One of my colleagues is seeing this when trying to install avn today on nodejs 4.2.6:\r\n\r\n```\r\n/Users/john/.avn/node_modules/bluebird/js/main/promise.js:677\r\n            throw e;\r\n            ^\r\n\r\nTypeError: fs.readFile(...).catch(...).then(...).reduce is not a function\r\n    at Object.exports._all (/Users/john/.avn/lib/plugins.js:56:4)\r\n    at Object.all (/Users/john/.avn/lib/plugins.js:21:38)\r\n    at Object.exports.first (/Users/john/.avn/lib/plugins.js:84:33)\r\n    at match (/Users/john/.avn/lib/hooks.js:29:18)\r\n    at Object.<anonymous> (/Users/john/.avn/lib/hooks.js:76:29)\r\n    at Object.tryCatcher (/Users/john/.avn/node_modules/bluebird/js/main/util.js:26:23)\r\n    at Promise._settlePromiseFromHandler (/Users/john/.avn/node_modules/bluebird/js/main/promise.js:507:31)\r\n    at Promise._settlePromiseAt (/Users/john/.avn/node_modules/bluebird/js/main/promise.js:581:18)\r\n    at Promise._settlePromises (/Users/john/.avn/node_modules/bluebird/js/main/promise.js:697:14)\r\n    at Async._drainQueue (/Users/john/.avn/node_modules/bluebird/js/main/async.js:123:16)\r\n    at Async._drainQueues (/Users/john/.avn/node_modules/bluebird/js/main/async.js:133:10)\r\n    at Immediate.Async.drainQueues [as _onImmediate] (/Users/john/.avn/node_modules/bluebird/js/main/async.js:15:14)\r\n    at processImmediate [as _immediateCallback] (timers.js:383:17)\r\n```\r\n\r\nWhen tracing through this, it seems like the promise returned from fs.readFile (via the mz module) is actually a native ES6 Promise instead of a bluebird Promise. But since avn relies on the reduce() method, which is not part of the ES6 Promise spec, it should probably force mz to use bluebird as its Promise implementation. Per https://www.npmjs.com/package/mz , the way to do this seems to be:\r\n\r\n```js\r\nrequire('any-promise/register')('bluebird');\r\n```\r\n\r\nThis may also need an update to mz 2.3.1"},"comment":{"url":"https://api.github.com/repos/wbyoung/avn/issues/comments/178272040","html_url":"https://github.com/wbyoung/avn/issues/38#issuecomment-178272040","issue_url":"https://api.github.com/repos/wbyoung/avn/issues/38","id":178272040,"user":{"login":"wbyoung","id":57162,"avatar_url":"https://avatars.githubusercontent.com/u/57162?v=3","gravatar_id":"","url":"https://api.github.com/users/wbyoung","html_url":"https://github.com/wbyoung","followers_url":"https://api.github.com/users/wbyoung/followers","following_url":"https://api.github.com/users/wbyoung/following{/other_user}","gists_url":"https://api.github.com/users/wbyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/wbyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbyoung/subscriptions","organizations_url":"https://api.github.com/users/wbyoung/orgs","repos_url":"https://api.github.com/users/wbyoung/repos","events_url":"https://api.github.com/users/wbyoung/events{/privacy}","received_events_url":"https://api.github.com/users/wbyoung/received_events","type":"User","site_admin":false},"created_at":"2016-02-02T00:28:24Z","updated_at":"2016-02-02T00:28:24Z","body":"The best course of action will probably be to do as you've suggested, but for now have opened normalize/mz#31."}}