简体   繁体   English

如何在Node for Windows中启用和声?

[英]How to enable harmony in Node for Windows?

As I understand it, the following script should compile with the --harmony flag. 据我了解,以下脚本应使用--harmony标志进行编译。

// test.js
function* values() {
    for (var i = 0; i < arguments.length; i++) {
        yield arguments[i];
    }
}

eg, 例如,

node --harmony test.js

However, all I get is: 但是,我得到的只是:

test.js:1
unction (exports, require, module, __filename, __dirname) { function* values()
                                                                    ^
SyntaxError: Unexpected token *
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

I'm running Node v0.10.29. 我正在运行Node v0.10.29。

Does harmony not work on Windows? 和谐在Windows上不起作用吗?

You need Node v0.11.x. 您需要Node v0.11.x. You can find a copy on the http://blog.nodejs.org/release/ . 您可以在http://blog.nodejs.org/release/上找到一份副本。 The download links are buried, so you'll have to dig. 下载链接被埋没,所以你必须挖掘。 Here's a direct link for Node v.11.13 Windows x64 . 这是Node v.11.13 Windows x64直接链接

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

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