mapbox / geobuf

A compact binary encoding for geographic data.
ISC License
967 stars 84 forks source link

fatal crash of tool #80

Closed ehanoj closed 7 years ago

ehanoj commented 7 years ago

I will install tools on Linux Mint 18.1 Serena without error:

$ sudo npm install -g geobuf

All convert tool crash, i.e. json2geobuf. Any idea?

$ json2geobuf 

fs.js:540 binding.open(pathModule._makeLong(path), ^

TypeError: path must be a string at TypeError (native) at Object.fs.open (fs.js:540:11) at ReadStream.open (fs.js:1677:6) at new ReadStream (fs.js:1664:10) at Object.fs.createReadStream (fs.js:1612:10) at Object. (/usr/local/lib/node_modules/geobuf/bin/json2geobuf:8:38) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12)

$ json2geobuf issue62.json > issue62.pbf

/usr/local/lib/node_modules/geobuf/bin/json2geobuf:20 var buffer = Buffer.from(encode(geojson, new Pbf())); ^

TypeError: this is not a typed array. at Function.from (native) at /usr/local/lib/node_modules/geobuf/bin/json2geobuf:20:25 at ConcatStream. (/usr/local/lib/node_modules/geobuf/node_modules/concat-stream/index.js:36:43) at emitNone (events.js:72:20) at ConcatStream.emit (events.js:166:7) at finishMaybe (/usr/local/lib/node_modules/geobuf/node_modules/readable-stream/lib/_stream_writable.js:607:14) at endWritable (/usr/local/lib/node_modules/geobuf/node_modules/readable-stream/lib/_stream_writable.js:615:3) at ConcatStream.Writable.end (/usr/local/lib/node_modules/geobuf/node_modules/readable-stream/lib/_stream_writable.js:571:41) at ReadStream.onend (_stream_readable.js:490:10) at ReadStream.g (events.js:260:16)

mourner commented 7 years ago

Looks like this was caused by using an older Node version which didn't provide support for Buffer.from(typedArray). Should work properly for Node v4.5.0+.