node.js - nodejs SyntaxError: Unexpected token -
i using elasticsearch-exporter export data elasticsearch.
the tool nodejs application.
when try use following command node exporter.js make tool list available options, crashes following exception
/home/me/storage/elasticsearch-exporter/log.js:54 exports.error = (...args) => !capture("error", args) && console.log(timestamp() + util.format(...args).red); ^^^ syntaxerror: unexpected token ... @ exports.runinthiscontext (vm.js:53:16) @ module._compile (module.js:374:25) @ object.module._extensions..js (module.js:417:10) @ module.load (module.js:344:32) @ function.module._load (module.js:301:12) @ module.require (module.js:354:17) @ require (internal/module.js:12:17) @ object.<anonymous> (/home/anas/storage/elasticsearch-exporter/exporter.js:9:11) @ module._compile (module.js:410:26) @ object.module._extensions..js (module.js:417:10) here line exception thrown
exports.error = (...args) => !capture("error", args) && console.log(timestamp() + util.format(...args).red); i think error related different version of nodejs not sure.
here output of node --version command v4.2.6
here output of npm --version command 3.10.6
yes, indeed, ... called spread operator , available since node.js 6
the elasticsearch-exporter project declares in package.json file works node version > 6
so since you're running node.js 4.2.6, either need upgrade node.js installation or fork elasticsearch-exporter project , modify work node.js 4.2.6.
Comments
Post a Comment