nitrojs / nitrojs/nitro

WASM files from the dependencies are not copied during the build

Open
#3,581 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Describe the bug

When you build the Nitro.js project which depends on tesseract.js (which in turn depends on tesseract.js-core), the wasm files are not copied from the tesseract.js-core package to the output directory.

Reproduction

Clone and build the project:

git clone https://github.com/slavafomin/nitro-wasm-issue && cd nitro-wasm-issue
npm install

DEV mode:

npm run dev
open "http://localhost:3001"

Everything should work.

Production mode:

npm run build
node ./.output/server/index.mjs
open "http://localhost:3000"

Getting error:

Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm')
failed to asynchronously prepare wasm: RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm'). Build with -sASSERTIONS for more info.
Aborted(RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm'). Build with -sASSERTIONS for more info.)
[uncaughtException] Error [RuntimeError]: Aborted(Error: ENOENT: no such file or directory, open '/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.wasm'). Build with -sASSERTIONS for more info.
    at n (/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.js:13:225)
    at Ma (/nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.js:14:143)
    at /nitro-wasm-issue/.output/server/node_modules/tesseract.js-core/tesseract-core-simd.js:14:491

WASM files are missing from the dependency:

ls -lah ./.output/server/node_modules/tesseract.js-core/*.wasm
ls: cannot access './.output/server/node_modules/tesseract.js-core/*.wasm': No such file or directory
Environment
$ node --version
v22.19.0
$ npm --version
11.6.0
$ npx nitro --version
2.12.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the production build with the linked Nitro.js example using npm run build, then inspect the build output under .output/server/node_modules/tesseract.js-core and the dependency handling used by the production build. The fix is complete when the required .wasm files are present in the output and node ./.output/server/index.mjs runs without the ENOENT error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.