Public bug reported:

node-cheerio 1.2.0+~cs2.1.0-2 in stonking-proposed cannot be loaded with
require(), which breaks CommonJS consumers. This blocks node-cheerio
from migrating and, through it, node-parse5 and node-jsdom.

Symptom: the eslint autopkgtest fails on every architecture (amd64, amd64v3, 
arm64, armhf, ppc64el) when triggered by node-cheerio/1.2.0+~cs2.1.0-2:
  not ok 381 - tests/lib/cli-engine/formatters/html.js
    message: '"cheerio" is not found.'   ruleId: node/no-missing-require
https://autopkgtest.ubuntu.com/results/autopkgtest-stonking/stonking/amd64/e/eslint/20260928_111538_1192f@/log.gz

Reproducer (Node 24.19, stonking-proposed):
  $ node -e 'require("cheerio")'
  Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in 
/usr/share/nodejs/cheerio/package.json

Cause: upstream cheerio 1.2.0 is a dual CJS and ESM package built with tshy, 
and its exports include
  "require": { "types": "./dist/commonjs/index.d.ts", "default": 
"./dist/commonjs/index.js" }
debian/patches/debian-build-adjustments.patch removes the "require" conditions 
for ".", "./slim" and "./utils" and sets the tshy "dialects" to ["esm"]. The 
binary package therefore ships only dist/esm and dist/browser, with no 
dist/commonjs. None of the other changes in that patch (TypeScript 5.2 
compatibility, the cheerio-select adapter fix, dropping 
fromURL/loadBuffer/stream helpers) appear to need ESM-only output.

Impact on proposed-migration: node-parse5 8.0.1+dfsg-3build3 Breaks
node-cheerio (<< 1.2~) and node-jsdom (<< 20.0.3+~cs124.18.21-7~).
Because node-cheerio is not a candidate, node-parse5 makes jest, ts-
jest, node-jest-react, jupyterlab, node-jupyter-widgets-*, node-bqplot,
node-ipydatagrid, node-jsdom, node-cheerio, node-http-server,
perlnavigator and python-ipywidgets-doc uninstallable, so it stays in
proposed. node-jsdom -10build3 is in turn held behind node-parse5.

Suggested fix: keep the CommonJS dialect ("dialects": ["esm",
"commonjs"]) and the "require" export conditions in debian-build-
adjustments.patch, so that dist/commonjs is built and shipped again.
This should also be fixed in Debian, where no bug has been reported yet.

** Affects: node-cheerio (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: node-parse5 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: update-excuse

** Tags added: update-excuse

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169270

Title:
  node-cheerio 1.2.0 is ESM-only: require("cheerio") fails with
  ERR_PACKAGE_PATH_NOT_EXPORTED (eslint autopkgtest regression, blocks
  node-parse5)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/node-cheerio/+bug/2169270/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to