zombie icon indicating copy to clipboard operation
zombie copied to clipboard

SyntaxError: Use of const in strict mode.

Open eduardoinnorway opened this issue 11 years ago • 7 comments

Using node v0.12.2 and cucumber.js, any work around here?

eduardoinnorway avatar Apr 30 '15 14:04 eduardoinnorway

Forgot to mention, it is jsdom that uses ECMAScript 6 const and let, that causes the actual error.

eduardoinnorway avatar Apr 30 '15 15:04 eduardoinnorway

No work around, JSDOM doesn't support Node.js, only io.js.

assaf avatar Apr 30 '15 15:04 assaf

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]

chizmeeple avatar May 18 '15 14:05 chizmeeple

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.

chizmeeple avatar May 18 '15 14:05 chizmeeple

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]

chizmeeple avatar May 18 '15 15:05 chizmeeple

+1 with [email protected], guess i should consider checking out io.js ?

martinlindhe avatar Aug 07 '15 21:08 martinlindhe

yep, 4.0.8 works fine with node.

pronebird avatar Aug 16 '15 23:08 pronebird