Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

SyntaxError: Use of const in strict mode. #909

Open
eduardoinnorway opened this issue Apr 30, 2015 · 7 comments
Open

SyntaxError: Use of const in strict mode. #909

eduardoinnorway opened this issue Apr 30, 2015 · 7 comments

Comments

@eduardoinnorway
Copy link

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

@eduardoinnorway
Copy link
Author

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

@assaf
Copy link
Owner

assaf commented Apr 30, 2015

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

@chizmw
Copy link

chizmw commented May 18, 2015

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 'jsdom@5.2.0' the requirement from zombie, or an alternative version it /is/ using?

➔ npm list jsdom
/Users/c.wright
├── jsdom@5.4.1
└─┬ zombie@4.0.10
  └── jsdom@5.2.0

@chizmw
Copy link

chizmw commented May 18, 2015

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 jsdom@3.1.2

appears to resolve the issue.

@chizmw
Copy link

chizmw commented May 18, 2015

Aha!

npm install zombie@4.0.8

returns me to a setup that will run mocha+zombie tests.

➔ npm ls zombie
/Users/c.wright
└── zombie@4.0.8

➔ npm ls jsdom
/Users/c.wright
└─┬ zombie@4.0.8
  └── jsdom@5.0.1

@martinlindhe
Copy link

+1 with zombie@4.0.13, guess i should consider checking out io.js ?

@pronebird
Copy link

yep, 4.0.8 works fine with node.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants