5

Trying to run these new features as shown http://h3manth.com/new/blog/2013/es6-on-nodejs/, specifically Generators in my local node environment. Any reason when I run node --harmony --use-strict es6.js on any Node versions before 0.11.4 I get the errors

function *Counter() {
     ^
SyntaxError: Unexpected token *
etc...

It works on any versions 0.11.4 and after, but when add a --debug-brk statement in there I get

global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0);
                       ^
ReferenceError: break_point is not defined

Not sure why it gives me the option to enable harmony, but not utilize it in previous versions, and why can't I debug the later versions?

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
Marius Miliunas
  • 1,023
  • 18
  • 34
  • Don't use `--use-strict` option. If you're using 3rd party modules, you're forcing strict mode on them for no reason. If you want to use strict mode, you have to specify it at the beginning on your files. – alex Mar 28 '14 at 01:18
  • Theres an issue on their github issue tracker but no response yet https://github.com/joyent/node/issues/7363#issuecomment-43405861 – George May 17 '14 at 20:15

1 Answers1

0

--harmony-generators has been added in Node v0.11, that's certainly why your code couldn't be parsed.

Break debugging with --use-strict is an issue since now that has just been fixed is node v0.12 development branch.

If you feel like building your own version of node from latest sources, you should be able to debug your generator!

Source: https://github.com/joyent/node/issues/8685

ngasull
  • 4,206
  • 1
  • 22
  • 36