简体   繁体   English

节点 v11 使用扩展运算符抛出

[英]Node v11 throws with spread operator

I'm trying to build an electron app and I'm using electron-unhandled in it, but when running my app it throws我正在尝试构建一个电子应用程序,并且在其中使用电子未处理,但是在运行我的应用程序时它会抛出

App threw an error during load C:\CLC\VIDA\Web\Comun\ypalma\todoapp\node_modules\electron-unhandled\index.js:74
                ...options,
                ^^^ SyntaxError: Unexpected token ...
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\CLC\VIDA\Web\Comun\ypalma\todoapp\index.js:3:19)
    at Module._compile (module.js:556:32)

The line of the reference has this code参考行有这个代码

options = {
    ...options,
    ...inputOptions
};

Now, the weird thing is that I'm using node v11.5.0 which has support for spread operator, so I'm stuck with this.现在,奇怪的是我正在使用支持扩展运算符的节点 v11.5.0,所以我坚持使用它。 So, the question is, how can I make this work without compilling to es5?所以,问题是,我怎样才能在不编译到 es5 的情况下完成这项工作? I mean, node is supposed to handle this syntax right?我的意思是,节点应该处理这种语法吗?

In case it helps, my electron version is v5.0.1 and I'm working with windows 10.如果有帮助,我的电子版本是 v5.0.1,我正在使用 Windows 10。

So, after @TJCrowder advises, I found that my electron app was running a different version of node and electron.因此,在@TJCrowder 提出建议后,我发现我的电子应用程序运行的是不同版本的节点和电子。 The electron version installed was ^5.0.1 , but the issue was that I also have electron-prebuilt installed, which has node version 6.0.5 and electron version 1.4.13 .安装的电子版本是^5.0.1 ,但问题是我还安装了electron-prebuilt ,它有节点版本6.0.5和电子版本1.4.13 So this module overrides my node and electron versions.所以这个模块覆盖了我的节点和电子版本。 Simply uninstalling it and reinstalling electron did the trick.只需卸载它并重新安装电子就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM