zemirco / json2csv

Convert json to csv with column titles
http://zemirco.github.io/json2csv
MIT License
2.71k stars 365 forks source link

Unexpected Token #323

Closed 3ruce closed 6 years ago

3ruce commented 6 years ago

I'm running 4.2.1 on ubuntu server 16.04 with the command below against the attached tweets.json file (I just added the .txt file to be able to upload it).

json2csv -i tweets.json -f user,text,fullname,id,timestamp -o out.csv

tweets.json.txt

The error I get is below and the json file is valid according to http://jsonlint.com. Do you know what the problem might be? I run json2csv on 2 other machines without any problems, so I'm a bit puzzled.

/usr/local/lib/node_modules/json2csv/bin/utils/TablePrinter.js:86
      ...Array(vertPadTop).fill(emptyLine),
      ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/json2csv/bin/json2csv.js:11:22)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
knownasilya commented 6 years ago

Sounds like you are running an old version of Node.js. Give the latest version a try (or 6+).

3ruce commented 6 years ago

I'm running version 10 and a quick test has worked... if I run into any other problems, I'll let you know... Thanks for your help!

juanjoDiaz commented 6 years ago

Awesome! I'll close this. Feel free to reopen if you have any other issue.