elasticdump 安装问题:async _loop Unexpected identifier error

Problem with elasticdump installation: async _loop Unexpected identifier error

安装 elasticdump 会抛出一堆这样的警告

$ npm install -g elasticdump
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated s3signed@0.1.0: This module is no longer maintained. It is provided as is.
/Users/ebeisaac/.npm-packages/bin/elasticdump -> /Users/ebeisaac/.npm-packages/lib/node_modules/elasticdump/bin/elasticdump
/Users/ebeisaac/.npm-packages/bin/multielasticdump -> /Users/ebeisaac/.npm-packages/lib/node_modules/elasticdump/bin/multielasticdump
npm WARN notsup Unsupported engine for elasticdump@6.56.0: wanted: {"node":">=10.0.0"} (current: {"node":"6.13.1","npm":"6.14.9"})
npm WARN notsup Not compatible with your version of node/npm: elasticdump@6.56.0
npm WARN notsup Unsupported engine for fast-csv@4.3.5: wanted: {"node":">=10.0.0"} (current: {"node":"6.13.1","npm":"6.14.9"})
npm WARN notsup Not compatible with your version of node/npm: fast-csv@4.3.5
npm WARN notsup Unsupported engine for p-queue@6.6.2: wanted: {"node":">=8"} (current: {"node":"6.13.1","npm":"6.14.9"})
npm WARN notsup Not compatible with your version of node/npm: p-queue@6.6.2
npm WARN notsup Unsupported engine for p-timeout@3.2.0: wanted: {"node":">=8"} (current: {"node":"6.13.1","npm":"6.14.9"})
npm WARN notsup Not compatible with your version of node/npm: p-timeout@3.2.0

+ elasticdump@6.56.0
updated 1 package in 15.284s

之后,可执行文件在调用时总是抛出以下错误

$ elasticdump --version   
/Users/ebeisaac/.npm-packages/lib/node_modules/elasticdump/lib/processor.js:40
  async _loop (limit, offset, totalWrites) {
        ^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/ebeisaac/.npm-packages/lib/node_modules/elasticdump/elasticdump.js:3:28)

我什至尝试完全按照 this website 中的安装方式安装 npm。结果还是一样

如何解决此问题并使 elasticdump 正常工作?

来自日志:

npm WARN notsup Unsupported engine for p-timeout@3.2.0: wanted: {"node":">=8"} (current: {"node":"6.13.1","npm":"6.14.9"})

您正在使用 node.js 版本 6.x,但它不支持节点 v6。您需要升级到 v8 或更高版本。

你也可以参考this and this Github issues

in conda that prevents it from installing the latest nodejs version in a Mac. In which case, the solution would be to uninstall the conda version and use an alternative like homebrew or a pkg from the official site.

注意:不要同时安装 conda 和 homebrew 版本,否则即使执行 homebrew 的 npm 也会抛出问题中显示的相同错误。