tumblrwks
tumblrwks copied to clipboard
Promise is not defined error
When trying to run
var Tumblr = require('tumblrwks');
/*
You can get the consumerKey and consumerSecret by registing a tumblr app: http://www.tumblr.com/oauth/apps
*/
var tumblr = new Tumblr(
{
consumerKey: 'your consumer key'
}//, "arktest.tumblr.com"
// specify the blog url now or the time you want to use
);
tumblr.get('/info', {hostname: 'arktest.tumblr.com'}, function(err, json){
console.log(json);
});
// Or with Promises
tumblr.get('/info', {hostname: 'arktest.tumblr.com'}).
then(function (json) {
console.log(json);
}, function (error) {
console.log(error)
});
});
I get in the log the "Promise is not defined" error.
Thanks.
UPDATE: following http://stackoverflow.com/questions/35639924/why-would-i-get-a-promise-is-not-defined-error-on-node-v5-7-0 I modified https://github.com/arkxu/tumblrwks/blob/master/lib/tumblrwks.js adding at the top the following line
// fix error in log when using tumblrwks: Promise is not defined
var Promise = require('es6-promise').Promise;
and then running
npm install -S es6-promise
The error is not happening anymore.