Closed sigmaSd closed 5 months ago
This @techstark/opencv-js
is not mentioned as a dependency that why it fails, seems like this project relies for now on cloning this repo
Also I think you should document that it requires git-lfs extension, it took me a while to figure out its needed since I never used it before
Run bun a.ts
and I get error: Cannot find module "npm:@gutenye/ocr-node"
, changed import Ocr from "npm:@gutenye/ocr-node";
to import Ocr from "@gutenye/ocr-node"
works for me.
The @techstark/opencv-js
dependency is in @gutenye/ocr-node package, somehow bun can't find it. But it works for me.
Also I think you should document that it requires git-lfs extension, it took me a while to figure out its needed since I never used it before
Fixed in https://github.com/gutenye/ocr/commit/12b02bbb9b31ed6ef36b2df69cde72a4c2613db1
I just published a new version 1.3.1, fixed can't find #/common/..
file in bun. Please give it a try. And let me know if you still have problems.
still the same error, the error is telling me that ocr-common 1.4.0 is referencing that package but its not specified in package.json
https://www.npmjs.com/package/@gutenye/ocr-common?activeTab=dependencies
@sigmaSd can you test if this works by adding the missing deps to the peerDependencies
field in ocr-common/package.json?
I can do that later Btw you should be also able to reproduce the problem, I think you just need to run the script outside of the repo (the one you have locally)
I can't reproduce it. bun install deps in ./node_modules
folder, not ~/.bun/install/cache
folder.
Anyway I moved the deps back to @gutenye/ocr-comon package here, can you re test it? (1.4.1 version)
For deno, it didn't work for me, caused by another error
deno run --reload a.ts
error: Unable to load node_modules/.deno/js-clipper@1.0.1/node_modules/js-clipper/clipper.js imported from node_modules/.deno/@gutenye+ocr-common@1.4.1/node_modules/@gutenye/ocr-common/build/backend/splitIntoLineImages.js
Caused by:
invalid utf-8 sequence of 1 bytes from index 165105
This was fixed in deno , you can upgrade with deno upgrade --canary to test it, the fix should be released in the next version (1.44.2)
and just for info, bun still doesn't work in my case Bun v1.1.12 (Linux x64 baseline)
error: Cannot find module "@techstark/opencv-js" from "/home/mrcool/.bun/install/cache/@gutenye/ocr-common@1.4.1/src/backend/splitIntoLineImages.ts"
but honestly I'm only interested in deno, and it does work now so I don't plan to investigate further
I see bun does work but only if I do the following:
What didn't work is these next step :
So maybe the second way is not supported ?
Also I just noticed for deno , doesn't detect anything unfortunately, so I guess its something I'll investigate when I can
The second way is not supported. Thanks for the further investigation.
@gutenye It works now with deno, tested with deno 1.45.4 ocr-node 1.4.4
no need to create a directory, npm install or any thing , just a single typescript file
import Ocr from "npm:@gutenye/ocr-node@1.4.4";
const ocr = await Ocr.create();
const s = performance.now();
const result = await ocr.detect(
Deno.args[0],
);
console.log(`${performance.now() - s}ms`, result);
and deno run a.ts image
bun in mentioned in the docs so I thought it would work, but it doesn't seem so
bun 1.1.8 (linux)
a.ts
bun add @gutenye/ocr-node bun i bun a.ts
Deno gives the same error