Skip to content

Bump min supported node version from 10.19 to 12.20 #23663

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

Closed
wants to merge 1 commit into from

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Feb 12, 2025

This is the minimum node version that we support targeting. Bumping to v12.20 specifically allows us to start using node:xx for imports. See #18235

Fixes: #23652

@sbc100 sbc100 marked this pull request as ready for review February 12, 2025 19:49
@sbc100 sbc100 requested review from dschuff and kripken February 12, 2025 19:49
@sbc100 sbc100 force-pushed the bump_min_node_version branch from 6c0cadb to ea59226 Compare February 12, 2025 19:54
This is the minimum node version that we support targeting.  Bumping
to v12.20 specifically allows us to start using `node:xx` for imports.
See emscripten-core#18235

Fixes: emscripten-core#23652
@sbc100 sbc100 force-pushed the bump_min_node_version branch from ea59226 to 3a8e30c Compare February 12, 2025 23:04
@kleisauke
Copy link
Collaborator

The node: prefix in require(...) is only supported since v14.18.0, see:
#18235 (comment)
https://nodejs.org/api/modules.html#built-in-modules

@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 13, 2025

The node: prefix in require(...) is only supported since v14.18.0, see: #18235 (comment) https://nodejs.org/api/modules.html#built-in-modules

Oh wow, I was confused.

It looks like v14.18.0 does work.. but strangely v15.14.0 does not:

$ /usr/local/google/home/sbc/bin/node-v14.1/bin/node -e "require('node:fs')"
$ /usr/local/google/home/sbc/bin/node-v15.14.0-linux-x64/bin/node -e "require('node:fs')"
node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'node:fs'
Require stack:
- /usr/local/google/home/sbc/dev/wasm/emscripten/[eval]
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at [eval]:1:1
    at Script.runInThisContext (node:vm:131:12)
    at Object.runInThisContext (node:vm:308:38)
    at node:internal/process/execution:77:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:76:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/google/home/sbc/dev/wasm/emscripten/[eval]' ]
}

@kleisauke
Copy link
Collaborator

kleisauke commented Feb 13, 2025

Ah, looking at https://github.com/orgs/nodejs/discussions/45900#discussioncomment-4660547, I see where the confusion came from. The node: prefix has been supported since:

  • Node.js ^12.20.0 or >=14.13.1 for ESM import;
  • Node.js ^14.18.0 or >=16.0.0 for CommonJS require(...).

but strangely v15.14.0 does not:

Yeah, usually these features only land in LTS/even-numbered releases.

@kleisauke
Copy link
Collaborator

... here's a better reference: https://nodejs.org/api/esm.html#esm_node_imports.

@dschuff
Copy link
Member

dschuff commented Feb 14, 2025

According to https://github.com/nodejs/release#release-schedule Node 16 was released in 2021-10-26 and went out of LTS support on 2023-09-11, almost 1.5 years ago. The version of node on Debian Stable (one of the more conservative distros about updating) is now on node 18. So it seems this should be pretty safe.
In any case I think we can go past node 10, not even https://www.herodevs.com/support/node-nes supports node 10 anymore.

@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 14, 2025

I think I'm going to abandon this change since bump to 12.20 doesn't really buy us anything (AFAICT). We would need to bump to 16 to be able to unconditionally use node: prefixed imported.

@sbc100 sbc100 closed this Feb 14, 2025
@sbc100 sbc100 deleted the bump_min_node_version branch February 14, 2025 21:12
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

Successfully merging this pull request may close these issues.

Consider bumping the minimum support node version supported by the generated code.
3 participants