topojson / topojson-server

Convert GeoJSON to TopoJSON.
ISC License
117 stars 32 forks source link

ReferenceError: Promise is not defined #11

Closed mvl22 closed 6 years ago

mvl22 commented 6 years ago

I get (using node on Ubuntu 14.04):

$ geo2topo us-states.js > us.topo

/usr/local/lib/node_modules/topojson-server/bin/geo2topo:25
Promise.all(commander.args.map(read)).then(write).catch(abort);
^
ReferenceError: Promise is not defined
    at Object.<anonymous> (/usr/local/lib/node_modules/topojson-server/bin/geo2topo:25:1)
    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:902:3

https://stackoverflow.com/a/35640553 implies that there could be a missing dependency, perhaps, but I'm not a node expert.

I have:

$ /usr/bin/node -v
v0.10.25

$ npm -g ls
/usr/local/lib
├── es6-promise@4.1.1
└─┬ topojson-server@3.0.0
  └── commander@2.11.0
mbostock commented 6 years ago

You’ll need a more recent version of Node that supports Promises. I don’t recall exactly when Node added native support for Promises. 0.12 maybe? Ideally something more recent.

mvl22 commented 6 years ago

Thanks. Would it be worth explicitly noting this dependency in the package.json file?

https://stackoverflow.com/questions/29349684/

mbostock commented 6 years ago

Yes, I would welcome a PR to add the engines field to the package.json. Thank you!