mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3167] [Issue]: Sprite generation unavailable on Termux — TERMUX_FORCE_INSTALL never actually forces pnpm to install @img/sharp-wasm32 #1699
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1699
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Magiwarriorx on GitHub (Jul 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3167
Originally assigned to: @SpicyMarinara on GitHub.
Summary
On Termux/Android, sprite generation (and all other
sharp-backed image processing) is unavailable becausesharphas zero platform binaries installed — not the native@img/sharp-linux-arm64(correctly filtered out; see below) and, more importantly, not the@img/sharp-wasm32fallback the setup is supposed to rely on. Root cause:start-termux.shwritessupportedArchitectures.cpu[]=wasm32into.npmrcand setsTERMUX_FORCE_INSTALL=1, but the "force" path only runs a plainpnpm install, which no-ops against an already-satisfied lockfile and never re-links the newly-allowed optional dependency.Expected behavior
On Termux, after
start-termux.shadds the wasm32 architecture to.npmrc,pnpmshould install@img/sharp-wasm32,sharpshould load via its built-in wasm fallback, and sprite generation / background cleanup should work.Actual behavior
sharpfails to load entirely.GET /api/sprites/capabilitiesreportsspriteGenerationAvailable: false, and the sprite generation UI is disabled. On disk,node_modules/.pnpmcontains onlysharp@0.34.5and@img/colour(a pure-JS helper) — no@img/sharp-*binary package at all.Because
packages/server/src/routes/sprites.routes.tsswallows the module-load error with a barecatch {}(around line 35), the underlying reason is invisible in logs, which is why this has been hard to pin down.Steps to reproduce
start-termux.sh..npmrccontainssupportedArchitectures.cpu[]=wasm32(the script adds it).ls node_modules/.pnpm | grep -i "img+sharp"→ nothing.@img/sharp-*binary is present.Environment
Logs, screenshots, or video
Diagnosis captured on a real device:
.npmrcdoes containsupportedArchitectures.cpu[]=wasm32(flag present).npm view @img/sharp-wasm32@0.34.5 os cpu libc→ onlywasm32(i.e.cpu: wasm32, noosorlibcconstraint), so the package is installable wherever wasm32 is an allowed CPU.sharp@0.34.5+@img/colour@1.1.0; no@img/sharp-*binary.corepack pnpm@<ver> install) throws no error and changes nothing — the classic "Already up to date" no-op.--forcefinally pulls@img/sharp-wasm32@0.34.5, after which the direct load test above printsLOADEDand sprite generation works.Additional context
Why the native binary is (correctly) absent. Termux runs on Android's bionic libc, not glibc/musl.
@img/sharp-linux-arm64is gatedlibc: glibc, so pnpm rightly filters it out — it would not run on bionic. This is why the whole Termux path depends on the@img/sharp-wasm32build; there is no native path on Termux.The actual bug is in
start-termux.sh. The force path:The comment where the flag is set (near line 64) says "Force pnpm to re-resolve optional deps on next install," but
run_pnpm installdoes not force anything. Whennode_modulesalready exists and the lockfile is satisfied, pnpm treats the install as up-to-date and never re-links the newly-permitted@img/sharp-wasm32. So the.npmrcedit and the actual install drift out of sync: the flag is written, but the packages it should pull in are never installed.Verified fix (on-device). Making the forced install actually force re-resolution installs
@img/sharp-wasm32and restores sprite generation. Simplest change: userun_pnpm install --forceon theTERMUX_FORCE_INSTALLpath (a more surgical alternative is to remove the stalenode_modules/.pnpm/sharp*/@imgentries before installing so only the sharp subtree is refetched).Suggested follow-ups (separate, smaller changes):
catch {}insprites.routes.ts(log the aggregated sharp load error atdebug/warn). sharp reports every failed candidate path, which makes "wasm package missing" vs. "wasm ran out of memory" vs. "compile blocked" diagnosable at a glance — this alone would have made the current bug obvious.@img/sharp-wasm32fallback more robust than a Termux-only, script-order-dependent.npmrcopt-in (e.g. also verify the package is present after install and re-run with--forceif not), so a user who installs outside the exactstart-termux.shpath isn't left with a non-functionalsharp.Notes:
sharpis already anoptionalDependencyand every call site lazy-loads it, so the server still boots without it — this is specifically about restoring functionality on Termux, not about crashes.Template check
@Magiwarriorx commented on GitHub (Jul 3, 2026):
Happy to PR this myself but wanted to respect CONTRIBUTING.md.
Fix tested and working on my S26 Ultra.
@SpicyMarinara commented on GitHub (Jul 3, 2026):
Codex is taking this issue in branch
codex/fix-termux-sharp-wasm-install, targetingstaging.@SpicyMarinara commented on GitHub (Jul 3, 2026):
Opened draft PR #3168 with the Termux forced-install fix and sharp-load diagnostic logging: https://github.com/Pasta-Devs/Marinara-Engine/pull/3168