Skip to content

imread() throws error "abort(ReferenceError: document is not defined). Build with -s ASSERTIONS=1 for more info." #103

@ggenellina

Description

@ggenellina

Based upon the node commonjs example:

const { getOpenCv } = require("./opencv.js");

async function main() {
  const { cv } = await getOpenCv();
  console.log("OpenCV.js is ready!");
  console.log(cv.getBuildInformation());
  const inputImage = cv.imread("Lenna.png");
  console.log("imread, done");
}

main();

Output:

(build info, as expected)
(a very long block of obfuscated code)

abort(ReferenceError: document is not defined). Build with -s ASSERTIONS=1 for more info.
(Use node --trace-uncaught ... to show where the exception was thrown)

Node.js v22.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions