SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) in elasticdump

I was trying to move elasticsearch data from one server to another using elasticdump. When I giving

elasticdump --input=http://192.168.0.122:9200/my_index --output=http://localhost:9200/my_index --type=mapping

/usr/local/lib/node_modules/elasticdump/lib/transports/elasticsearch.js:668
var { awsChain, awsAccessKeyId, awsIniFileProfile } =
self.parent.options
^

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 getIo (/usr/local/lib/node_modules/elasticdump/lib/ioHelper.js:29:18)
at new elasticdump (/usr/local/lib/node_modules/elasticdump/elasticdump.js:43:3)
at Object. (/usr/local/lib/node_modules/elasticdump/bin/elasticdump:96:16)

How should I solve this error?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

The problem is that your version of Node.js is too old and doesn’t support the latest features.

elasticdump requires at least node.js v8+, so you should upgrade node.js and then it should work.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply