Cannot install cordova barcode scanner plugin: "SyntaxError: Unexpected token =>"

Cannot install cordova barcode scanner plugin: "SyntaxError: Unexpected token =>"

我正在尝试安装此插件:https://github.com/phonegap/phonegap-plugin-barcodescanner 但出现以下错误:

SyntaxError: Unexpected token =>
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\guadha.peralta\AppData\Roaming\npm\node_modules\phonegap\lib\phonegap\serve.js:9:23)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)

可能是什么问题?

"arrow function"=>是ES6函数。将节点更新到开始支持 ES6 的最低 v4.4.5。在 windows 你必须安装最新版本的节点,它支持该类型的功能。

在 Windows

上更新节点
  • 运行 PowerShell 以管理员身份执行以下命令:

npm install -g npm-windows-upgrade