Repository navigation
lib not supported for the html-encoding-sniffer #13
Description
Activity
@nooperpudd Which Node.js version is this on?
Node v22.20.0
This should not be happening on 22.20
This isERR_REQUIRE_ESM, which was deprecated in v20.19.0 / v22.12.0
Unless Node.js is run explicitly with--no-experimental-require-module, this should not be reachable@nooperpudd How can I reproduce this / could you share a minimial setup how to observe this on 22.20?
I just upgraded the node package nuxt-i18n-micro to v2.16.3. and the dependencies package version is jsdom (6.0.0)
@nooperpudd Could you setup a repo to demonstrate this issue?
jsdom 6.0.0 should be unrelated and does not pull in@exodus/bytesanywhere in its dependency treeI see the same error but only when running on AWS Lambda using node 22 as well. This was working just fine with new builds from 2 weeks ago. Its only the build I ran on the 31st. Seems like something changed in a dependency between that time. I did not update any libraries in our project explicitly though I see jsdom went from 27.3.0 to 27.4.0 in that time so that is probably what did it.
*Edit: Forcing jsdom back down to 27.3.0 fixed it for this error. Ended up having to overriding parse5 down to v7 also for something similar.
- What is the exact Node.js version this is happening on?
- Do you have a way to reproduce this that you could share? (ideally a repo or a gist)
It happens with node@24 when loaded as transitive dependency via jsdom
=> Found "jsdom@27.4.0" => Found "@exodus/bytes@1.6.0" info Reasons this module exists - "jsdom" depends on it - Hoisted from "jsdom#@exodus#bytes" - Hoisted from "jsdom#html-encoding-sniffer#@exodus#bytes" info Disk size without dependencies: "432KB" info Disk size with unique dependencies: "432KB" info Disk size with transitive dependencies: "432KB" info Number of shared dependencies: 0Error [ERR_REQUIRE_ESM]: require() of ES Module /var/task/node_modules/@exodus/bytes/encoding-lite.js from /var/task/node_modules/html-encoding-sniffer/lib/html-encoding-sniffer.js not supported. Instead change the require of encoding-lite.js in /var/task/node_modules/html-encoding-sniffer/lib/html-encoding-sniffer.js to a dynamic import() which is available in all CommonJS modules. at TracingChannel.traceSync (node:diagnostics_channel:328:14) at Object.<anonymous> (/var/task/node_modules/html-encoding-sniffer/lib/html-encoding-sniffer.js:2:41)Reacted by Bryon Larrance@frodeaa once again: could you share a repo or gist to reproduce this?
ERR_REQUIRE_ESMis deprecated since Node.js>=22.12.0 | ^20.19.0, for all Node.js versions thatjsdomor@exodus/bytessupports (as specified inengines), and should not be triggered outside of special conditions (like purposely enabling it via a Node.js flag).Node.js documentation link: https://nodejs.org/docs/latest/api/errors.html#err_require_esm
If this can be reproduced outside of those conditions on supported Node.js versions, this needs a specific reproducible example of conditions in which this happens.
@ChALkeR Reproduced with https://github.com/frodeaa/exodus-html-encoding-sniffe
node --version v24.12.0 npm install && npm run build node -e "const m = require('./dist/handler.js'); m.handler()"Unable to reproduce it directly with node, only when loaded via AWS Lambda container,
so it is not clear what can be done to "fix" thisReacted by Nikita SkovorodaReacted by Nikita SkovorodaThanks!
This being AWS Lamdba specific explains things, they indeed purposely disabled Node.js default behavior for ESM loading.See https://docs.aws.amazon.com/lambda/latest/dg/lambda-nodejs.html#nodejs-experimental-features on how to restore it.
It's the default behavior in RC status.
Moreover,
@exodus/bytesdoesn't userequire(ESM)itself, it's just ESM-only.
You can'trequire()it if you have synchronous ESM loader disabled.
Upd: as of 2026-02-20, it's marked as Stable
Reacted by Hines VaughanSee also jsdom/jsdom@ebad33c, discussion in jsdom/jsdom#3961, jsdom/jsdom#3959
jsdom already relies on require(esm) to work.See also discussion at Vercel and their docs
Also, this thread
Reacted by mtlasoAh that makes sense. Appreciate the help! I will give that a try Monday. Apologies for not getting back to you on it earlier.
Reacted by Nikita Skovoroda- addedquestionFurther information is requestedFurther information is requestedand removed
on Jan 5, 2026 Unless more context is provided (e.g. with cases not related to AWS Lambda) this is answered
Will reopen if more scenarios ariseAlso the very reason for why this was removed in AWS is now gone.
require(ESM) is marked as stable in Node.js in the current form.require(ESM)is now marked as stable in Node.js
Reacted by Hines VaughanSee also discussion at Vercel and their docs
Also, this thread
Thanks, adding
NODE_OPTIONS=--experimental-require-moduleto vercel environment variables made it finally work for me@mtlaso Ideally, AWS Lambda should stop breaking Node.js configuration.
They just caused a lot of confusion for everyone without a good reason.Also, require(ESM) is stable in Node.js and is not going away (contrary to AWS doc)
Reacted by mtlasoLinking: nodejs/node#52697 (comment) (and links below that comment)
- added a commit that references this issue
on Apr 1, 2026
issue