Skip to content

Tweak the Node.js version listed in "engines", to ensure that process.getBuiltinModule is available #19777

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

Merged
merged 1 commit into from
Apr 6, 2025

Conversation

Snuffleupagus
Copy link
Collaborator

In order to use the PDF.js library in Node.js environments the process.getBuiltinModule functionality must be available, which was released in version 20.16.0, however we've seen repeated issues filed by users on older 20.x versions.

…s.getBuiltinModule` is available

In order to use the PDF.js library in Node.js environments the `process.getBuiltinModule` functionality must be available, which was released in [version `20.16.0`](https://nodejs.org/en/blog/release/v20.16.0), however we've seen repeated issues filed by users on older `20.x` versions.
@timvandermeij timvandermeij merged commit 36ece9a into mozilla:master Apr 6, 2025
9 checks passed
@timvandermeij
Copy link
Contributor

Good idea; thank you!

@Snuffleupagus Snuffleupagus deleted the Node-engines-20.16.0 branch April 6, 2025 20:29
@luckymore
Copy link

node22 still reproduces the issue

➜  pdf2png git:(v5.1.91) ✗ node pdf2png.mjs
Debugger listening on ws://127.0.0.1:64864/7fe0ed6a-a823-4e07-97ab-ef0f55014320
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Warning: Cannot access the `require` function: "TypeError: process.getBuiltinModule is not a function".
Warning: Cannot polyfill `DOMMatrix`, rendering may be broken.
Warning: Cannot polyfill `ImageData`, rendering may be broken.
Warning: Cannot polyfill `Path2D`, rendering may be broken.
Waiting for the debugger to disconnect...
file:///Users/zhangningning/Documents/github/pdfjs-mozilla/build/dist/legacy/build/pdf.mjs:12858
const SCALE_MATRIX = new DOMMatrix();
                     ^

ReferenceError: DOMMatrix is not defined
    at file:///Users/zhangningning/Documents/github/pdfjs-mozilla/build/dist/legacy/build/pdf.mjs:12858:22
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:474:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:119:5)

Node.js v22.1.0

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

Successfully merging this pull request may close these issues.

3 participants