Promise is not defined
pconerly opened this issue · comments
I'm running a node script that requires prismic, which I took from the readme:
#!/usr/bin/env node
var Prismic = require('prismic.io');
PRISMIC_CONFIG = {
api: "http://lesbonneschoses.prismic.io/api",
}
Prismic.api(PRISMIC_CONFIG.api, function(error, api) {
api.query("", function(error, response) { // An empty query will return all the documents
if (error) {
console.log("Something went wrong: ", err);
}
console.log("Documents: ", response.documents);
});
});
And I get the error:
> ./js/prismic_tasks/derp.js
/Users/peterconerly/src/2picmonkey/node_modules/prismic.io/lib/prismic.js:39
return new Promise(function(resolve, reject) {
^
ReferenceError: Promise is not defined
at Object.getApi (/Users/peterconerly/src/2picmonkey/node_modules/prismic.io/lib/prismic.js:39:14)
at Object.<anonymous> (/Users/peterconerly/src/2picmonkey/js/prismic_tasks/derp.js:10:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
npm ERR! picmonkey@0.0.0 prismic: `./js/prismic_tasks/derp.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the picmonkey@0.0.0 prismic script.
npm ERR! This is most likely a problem with the picmonkey package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./js/prismic_tasks/derp.js
npm ERR! You can get their info via:
npm ERR! npm owner ls picmonkey
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.4.0
npm ERR! command "/Users/peterconerly/.nvm/v0.10.30/bin/node" "/Users/peterconerly/.nvm/v0.10.30/bin/npm" "run" "prismic"
npm ERR! cwd /Users/peterconerly/src/2picmonkey
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/peterconerly/src/2picmonkey/npm-debug.log
npm ERR! not ok code 0
It seems like the dependencies are messed up :/
Just kidding, I was on an old version of node, 0.10.30
. When I used v4.2.2
it worked. Closing, but I'll keep it around for anyone else who derped like me.