Enzyme: Supported Node Version

Created on 20 Oct 2017  Â·  7Comments  Â·  Source: enzymejs/enzyme

I recently encountered the following error after updating to v3.

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=5".

This error was thrown in a node 4 environment and it looks like #1086 switched to rst-selector-parser which only supports node 5+ according to this file. Given that node 4 is no longer active (node release schedule) I am curious if enzyme has officially dropped support for node 4??? If so, would it make sense to update package.json to reflect this?

Most helpful comment

I removed the engines field in https://github.com/aweary/rst-selector-parser/pull/10 and just published the 2.2.3 patch release, which should fix this.

All 7 comments

No, it hasn't. rst-selector-parser needs to fix its engines field. @aweary?

I removed the engines field in https://github.com/aweary/rst-selector-parser/pull/10 and just published the 2.2.3 patch release, which should fix this.

That is fantastic, this should fix the issue once enzyme is using the new version, thank you ✨

I was wondering if the engines field should still be used so people know what versions of node are supported by enzyme?

If the engines field is specified and the node version does not match yarn will throw an error and stop whereas npm will throw a warning and continue. I guess which one you prefer is a personal preference but I think documenting the supported versions makes life easier when stuff isn't working.

For example, @aweary determined that rst-selector-parser test suite passes all the way back to 0.12 but that information is not easily available for new users of the library. They would have to either a test it themselves or did through all the PRs to find what versions of node are supported.

@samit4me fwiw enzyme doesn't need to update for you to get the new version; run npm update or rm -rf node_modules && npm install.

You are correct @ljharb removing node_modules and re-installing does work. What are your thoughts on documenting the supported node versions?

If yarn didn't error out, I'd do it - but because yarn errors out, I'd rather just not specify "engines" at all, and let users figure out if it works or not on their own.

Yeah, that's cool I totally get that. I think I on the other side of the fence and like how it errors out on node mismatch as it doesn't waste any more time than necessary.

CI config has node 4, 6 and 8, so I guess these are the supported versions of node, not sure why I didn't look there earlier. Thanks for your help guys.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timhonders picture timhonders  Â·  3Comments

blainekasten picture blainekasten  Â·  3Comments

aweary picture aweary  Â·  3Comments

heikkimu picture heikkimu  Â·  3Comments

AdamYahid picture AdamYahid  Â·  3Comments