SyntaxError: Use of const in strict mode.
Using node v0.12.2 and cucumber.js, any work around here?
Forgot to mention, it is jsdom that uses ECMAScript 6 const and let, that causes the actual error.
No work around, JSDOM doesn't support Node.js, only io.js.
I foolishly ran 'npm update' today and I've run into the same issue:
➔ mocha
/Users/c.wright/node_modules/zombie/node_modules/jsdom/lib/jsdom/living/node-iterator.js:3
const defineGetter = require("../utils").defineGetter;
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
...
I haven't investigated fully yet, and I don't fully understand this output. Is '[email protected]' the requirement from zombie, or an alternative version it /is/ using?
➔ npm list jsdom
/Users/c.wright
├── [email protected]
└─┬ [email protected]
└── [email protected]
I guess that this Stack Overflow answer explains it:
The lastest version of jsdom no longer works with Node.js. This is from their github page.
Note that as of our 4.0.0 release, jsdom no longer works with Node.js™, and instead requires io.js. You are still welcome to install a release in the 3.x series if you are stuck on legacy technology like Node.js™
So as Roman Dunin said, roll back the to the 3.x version if you want to use jsdom with Node.js. Version 3.1.2 was the last release before version 4.0.0
Sadly no combination of:
npm uninstall zombie
npm install zombie
npm install [email protected]
appears to resolve the issue.
Aha!
npm install [email protected]
returns me to a setup that will run mocha+zombie tests.
➔ npm ls zombie
/Users/c.wright
└── [email protected]
➔ npm ls jsdom
/Users/c.wright
└─┬ [email protected]
└── [email protected]
+1 with [email protected], guess i should consider checking out io.js ?
yep, 4.0.8 works fine with node.