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

createRequire is not a function #28

Open
tomhalley opened this issue Dec 11, 2024 · 1 comment
Open

createRequire is not a function #28

tomhalley opened this issue Dec 11, 2024 · 1 comment

Comments

@tomhalley
Copy link

I am trying to run scribe.js-ocr in an api endpoint with Next.JS. Here's a function called from my route (taken from the example)

'use server'
import scribe from 'scribe.js-ocr'

export const extractOCRFromImage = async () => {
  scribe
    .extractText(['https://tesseract.projectnaptha.com/img/eng_bw.png'])
    .then((res) => console.log(res))
}

I get the following error when running my next.js app on dev local:

 ⨯ TypeError: createRequire is not a function
    at eval (webpack-internal:///(rsc)/./node_modules/scribe.js-ocr/js/containers/fontContainer.js:29:24) {
  page: '/api/import'

This is on Node v20.16.0 with scribe-ocr version ^0.5.1

Any help would be greatly appreciated

@tomhalley tomhalley changed the title https://github.com/scribeocr/scribe.js/issues createRequire is not a function Dec 11, 2024
@Balearica
Copy link
Contributor

We have a functioning example using Next.js listed in the readme (see here). If you implement the configuration options found there Scribe.js should work with Next.js.

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