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

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope' #996

Open
sdeass opened this issue Jan 17, 2025 · 1 comment

Comments

@sdeass
Copy link

sdeass commented Jan 17, 2025

Tesseract.js version (version number for npm/GitHub release, or specific commit for repo)
v6.0.0
Describe the bug
1.
const worker = await Tesseract.createWorker('chi_sim', 1);
const ret = await worker.recognize(doSource);

const worker = await createWorker(lang, 1, {
  workerPath: 'https://unpkg.com/[email protected]/dist/tesseract.min.js',
  langPath: 'https://tessdata.projectnaptha.com/4.0.0_best',
  corePath: 'https://unpkg.com/[email protected]',
});
const ret = await worker.recognize(img);

To Reproduce
Steps to reproduce the behavior:

It is no response or show errors bellows:
b1b8a885-90e7-4e10-8e54-fdc50d66ffe4:1 Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://cdn.jsdelivr.net/npm/[email protected]/dist/worker.min.js' failed to load.
at b1b8a885-90e7-4e10-8e54-fdc50d66ffe4:1:1
(anonymous) @ b1b8a885-90e7-4e10-8e54-fdc50d66ffe4:1
index.jsx:198 Uncaught (in promise) Error: Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://cdn.jsdelivr.net/npm/[email protected]/dist/worker.min.js' failed to load.
at _callee$ (index.jsx:198:13)
at tryCatch (index.jsx:2:1)
at Generator.eval (index.jsx:2:1)
at Generator.eval [as throw] (index.jsx:2:1)
at asyncGeneratorStep (index.jsx:2:1)
at _throw (index.jsx:2:1)

Please attach any input image required to replicate this behavior.

Expected behavior
normally then before.

Device Version:

  • Mac OS Sonoma 14.3
  • Browser [e.g. chrome] or Node version [e.g. Node v16 or v23]
@Balearica
Copy link
Member

It's difficult to know what you mean by this given the lack of explanation, however based on your code snippet I am assuming you are trying to use unpkg because JSDelivr is blocked in China (per #899).

The workerPath value in your second snippet is pointed to the wrong file. It should be pointed to worker.min.js rather than tesseract.min.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