Skip to content

createRequire is not a function #28

@tomhalley

Description

@tomhalley

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

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