Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError on node < 10 #166

Closed
mjeanroy opened this issue Oct 18, 2020 · 2 comments
Closed

SyntaxError on node < 10 #166

mjeanroy opened this issue Oct 18, 2020 · 2 comments

Comments

@mjeanroy
Copy link

mjeanroy commented Oct 18, 2020

Hi,
I would like to report a SyntaxError occuring on node < 10 (so node 9, node 8, et .).
Here is the issue:

[...]/node_modules/jasmine/lib/loader.js:25
  return import(path);
         ^^^^^^

SyntaxError: Unexpected token import
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (internal/modules/cjs/loader.js:618:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
npm ERR! Test failed.  See above for more details.

The issue is due to this commit (support added for ES modules).

Before opening an issue, I tried to check in the documentation if there was a note about the supported version of node, but I did not find anything.

Maybe node < 10 is not supported anymore, so this is not an issue, but a note on the documentation should probably be added, and it should have been a major release since it is a breaking change but that's another debate ;)

@mjeanroy mjeanroy changed the title SyntaxeError on node < 10 SyntaxError on node < 10 Oct 18, 2020
sgravrock added a commit to jasmine/jasmine.github.io that referenced this issue Oct 20, 2020
sgravrock added a commit that referenced this issue Oct 20, 2020
@sgravrock
Copy link
Member

Sorry about that. We try not to break old versions of Node (or Python, or Ruby, or browsers) between major releases. But we also try not to make major releases too frequently, since we leave a noticeable group of users behind with each major release. When the ecosystem moves as quickly as Node does we're sometimes forced to make hard choices. In this case we'd turned off CI builds for some older (past end of life) Node versions due to toolchain bit rot. As a result, I didn't catch the breaking change.

I don't see a way to restore Node <10 support without removing ES module support. (Although I'd be happy to review a pull request that proves me wrong about that.)

We'll try to do a better job of documenting which Node versions are supported and of keeping them working between major releases. Realistically though, there are times when that's just going to mean doing a major release sooner rather than keeping old Node versions going longer.

BTW, Node 8 hit end of life at the end of last year and Node 9 hit end of life in mid 2018. I recommend upgrading, even if it's just to get security updates.

@mjeanroy
Copy link
Author

Sorry about that.

That's totally understandable, you don't have to be sorry!

I agree that an app must upgrade to node >= 10, the issue arise when writing a plugin for a tool that should still support node < 10 (such as Babel I guess, gulp, etc.). In this case, I think it is important that a plugin still support the same range of version, but maybe I'm wrong.

Anyway, thanks for the answer, I totally understand your reasons!

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

No branches or pull requests

2 participants