Skip to content
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

Deno support #114

Open
carloslfu opened this issue Dec 3, 2024 · 1 comment
Open

Deno support #114

carloslfu opened this issue Dec 3, 2024 · 1 comment

Comments

@carloslfu
Copy link

I don't know if this is within the project's scope, but tracking compatibility with JS runtimes may be useful. I tried using the SDK with Deno, but it failed. Here is the code:

import { zerox } from "npm:zerox";

const openaiAPIKey = Deno.env.get("OPENAI_API_KEY");

if (!openaiAPIKey) {
  throw new Error("OPENAI_API_KEY is not set");
}

const result = await zerox({
  filePath: "https://omni-demo-data.s3.amazonaws.com/test/cs101.pdf",
  openaiAPIKey,
});

console.log(result);

This is the error:

╰─❯ deno task start                                                                                                                                                  ─╯
Task start deno run -A --allow-scripts --env-file main.ts
error: Uncaught (in promise) TypeError: gm.prototype.options is not a function
    at Function.subClass (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/gm/index.js:108:16)
    at new a (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/pdf2pic/dist/index.js:1:1026)
    at c (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/pdf2pic/dist/index.js:1:3611)
    at exports.fromPath (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/pdf2pic/dist/index.js:1:5080)
    at file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/zerox/node-zerox/dist/utils.js:299:55
    at step (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/zerox/node-zerox/dist/utils.js:67:23)
    at Object.next (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/zerox/node-zerox/dist/utils.js:48:53)
    at file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/zerox/node-zerox/dist/utils.js:42:71
    at new Promise (<anonymous>)
    at __awaiter (file:///Users/c/d/p/deno-zerox-ocr/deno/node_modules/.deno/[email protected]/node_modules/zerox/node-zerox/dist/utils.js:38:12)

Useful info:

  • deno 2.1.2 (stable, release, x86_64-apple-darwin)
  • v8 13.0.245.12-rusty
  • typescript 5.6.2

Here is a repo to reproduce it, it contains both the Deno and Node versions: https://github.com/carloslfu/deno-zerox-ocr.

@tonydattolo
Copy link

same issue using deno as the kernal for jupyter notebooks. postinstall script is also failing, so manually install graphiksmagic and ghostscript, not sure if that's related

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

No branches or pull requests

2 participants