microsoft / OCR-Form-Tools

A set of tools to use in Microsoft Azure Form Recognizer and OCR services.
MIT License
511 stars 174 forks source link

TypeError : Cannot read property 'GlobalWorkerOptions' of undefined #899

Closed pankaj-maurya closed 3 years ago

pankaj-maurya commented 3 years ago

Describe the bug TypeError: Cannot read property 'GlobalWorkerOptions' of undefined Module../src/react/components/pages/prebuiltPredict/LoadFileHelper.ts E:/WORKING_PROJECTS/ATREYA-LABS/OCR-Form-Tools/src/react/components/pages/prebuiltPredict/LoadFileHelper.ts:7 4 | import HtmlFileReader from "../../../../common/htmlFileReader"; 5 | import {loadImageToCanvas, parseTiffData, renderTiffToCanvas} from "../../../../common/utils"; 6 |

7 | pdfjsLib.GlobalWorkerOptions.workerSrc = constants.pdfjsWorkerSrc(pdfjsLib.version); 8 | const cMapUrl = constants.pdfjsCMapUrl(pdfjsLib.version); 9 | 10 | export interface ILoadFileResult {

To Reproduce Steps to reproduce the behavior:

  1. run the application by command 'npm run react-start'
  2. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

Additional context I tried importing pdfjslib from build folder but that too is not working.

import * as pdfjsLib from "pdfjs-dist/build/pdf";

buddhawang commented 3 years ago

Hi @pankaj-maurya,

Thanks for reaching out, it seems npm had some issue resolving pdfjs lib. Can you please try using yarn as our README suggested?

Please let me know if this issue persisted with yarn, thanks!

pankaj-maurya commented 3 years ago

Hi @buddhawang ,

Thanks for your prompt response.

I tried using yarn as README suggested. Followed below steps -

Yarn install
Yarn start

But getting same error.

I am using windows 10 ( version : 1909, 64 bit OS) machine

image

pankaj-maurya commented 3 years ago

I just downloaded zipped code from repository ant it worked fine.

Hence closing the issue.