[GH-ISSUE #3975] [Issue]: Precise Reference fails on Termux due to sharp native module #2149

Closed
opened 2026-10-21 05:45:46 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @SpicyMarinara on GitHub (Jul 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3975

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Since v2.3.3, illustration and sprite generation fails on Termux when the character card image is sent as a Precise Reference. The optional sharp dependency cannot load or build for the android-arm64 runtime.

Expected behavior

Illustrations and sprites should generate successfully when the character card image is used as a reference, as they did before v2.3.3.

Actual behavior

Generation fails when the character card image is sent as a reference. Marinara reports that NovelAI Precise Reference Images require server image preprocessing, but sharp is unavailable.

Steps to reproduce

  1. Run Marinara Engine v2.3.3 in Termux on an Android arm64 device.
  2. Configure NovelAI image generation.
  3. Generate an illustration or sprite while sending the character card image as a Precise Reference.
  4. Observe that generation fails because the sharp native module is unavailable.

Environment

  • Marinara Engine version: v2.3.3
  • Install type: termux
  • OS + version: Android 12 on Samsung Galaxy S10e (arm64-v8a); Termux from F-Droid; Node.js v24.17.0; npm v11.17.0
  • Browser or app shell: Termux

Logs, screenshots, or video

Runtime error: "NovelAI precise reference images require server image preprocessing, but the optional sharp dependency is unavailable." Initial sharp error: "Could not load the "sharp" module using the android-arm64 runtime". After installing sharp@0.34.5, libvips v8.18.4-2, clang, make, python, node-gyp, and node-addon-api, rebuilding sharp starts a source build but fails with: "gyp: Undefined variable android_ndk_path in binding.gyp". Build output identifies node-gyp 13.0.1, Node.js 24.17.0, Android, arm64, and globally installed libvips.

Additional context

The repository was up to date with main matching origin/main. The issue reportedly occurs with NovelAI and image providers through OpenRouter or NanoGPT, but only when sending the character card image as a reference; generation without that reference works. The same workflow worked before v2.3.3. sharp has no prebuilt binary for android-arm64 and its source build expects an Android NDK environment that is not available or configured in Termux.

Discord thread: [Bug] NovelAI Precise Reference unavailable on Termux Android due to sharp native module failure
Discord thread link: https://discord.com/channels/1417099416812392641/1529786223143551017
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (2 messages)
[2026-07-23T09:44:17.651Z] Ozy: Hey, since v2.3.3 I can't generate illustrations nor sprites due to sharp native module.  It happens using NAI or an image provider through OR or NanoGPT. I used OpenAi to troubleshoot but it didn't worked so I asked him to make a summary for you. Here's the summary:

Environment
Project: Marinara Engine
Version tested: v2.3.3
OS: Android 12
Device: Samsung Galaxy S10e (arm64-v8a)
Runtime: Termux (F-Droid)
Node.js: v24.17.0
npm: 11.17.0
Description

When using NovelAI image generation with Precise Reference Images, Marinara fails with:

NovelAI precise reference images require server image preprocessing, but the optional sharp dependency is unavailable.

The feature cannot be used because the server-side image preprocessing dependency (sharp) fails to load.

Initial diagnosis
The repository is up to date (main matches origin/main).
sharp was initially missing.
Installing sharp@0.34.5 succeeds, but the native module cannot load on Android.

Initial runtime error:

Could not load the "sharp" module using the android-arm64 runtime
Troubleshooting performed

Installed:

sharp@0.34.5
libvips from Termux repositories (v8.18.4-2)
clang
make
python
node-gyp
node-addon-api

Added node-gyp as a development dependency.

Attempted rebuild:

cd ~/Marinara-Engine/packages/server

node /data/data/com.termux/files/usr/lib/node_modules/pnpm/bin/pnpm.mjs rebuild sharp

The build process now starts correctly:

sharp: Attempting to build from source via node-gyp
sharp: Found node-addon-api 8.9.0
sharp: Found node-gyp 13.0.1
sharp: Detected globally-installed libvips
gyp info using node-gyp@13.0.1
gyp info using node@24.17.0 | android | arm64

However, it fails with:

gyp: Undefined variable android_ndk_path in binding.gyp
Conclusion

sharp does not provide a prebuilt binary for the android-arm64 runtime, so it attempts a source build.

The build fails because the Android NDK environment expected by node-gyp is not available/configured in Termux.

Thank you.
[Discord message: https://discord.com/channels/1417099416812392641/1529786223143551017/1529786223143551017]

[2026-07-23T09:49:45.110Z] Ozy: I'd also like to precise that it only happens when trying to send the character card image as reference, otherwise it works fine. 

Before 2.3.3, everything worked fine.
[Discord message: https://discord.com/channels/1417099416812392641/1529786223143551017/1529787596606275674]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Jul 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3975 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Since v2.3.3, illustration and sprite generation fails on Termux when the character card image is sent as a Precise Reference. The optional sharp dependency cannot load or build for the android-arm64 runtime. ## Expected behavior Illustrations and sprites should generate successfully when the character card image is used as a reference, as they did before v2.3.3. ## Actual behavior Generation fails when the character card image is sent as a reference. Marinara reports that NovelAI Precise Reference Images require server image preprocessing, but sharp is unavailable. ## Steps to reproduce 1. Run Marinara Engine v2.3.3 in Termux on an Android arm64 device. 2. Configure NovelAI image generation. 3. Generate an illustration or sprite while sending the character card image as a Precise Reference. 4. Observe that generation fails because the sharp native module is unavailable. ## Environment - Marinara Engine version: v2.3.3 - Install type: termux - OS + version: Android 12 on Samsung Galaxy S10e (arm64-v8a); Termux from F-Droid; Node.js v24.17.0; npm v11.17.0 - Browser or app shell: Termux ## Logs, screenshots, or video Runtime error: "NovelAI precise reference images require server image preprocessing, but the optional sharp dependency is unavailable." Initial sharp error: "Could not load the \"sharp\" module using the android-arm64 runtime". After installing sharp@0.34.5, libvips v8.18.4-2, clang, make, python, node-gyp, and node-addon-api, rebuilding sharp starts a source build but fails with: "gyp: Undefined variable android_ndk_path in binding.gyp". Build output identifies node-gyp 13.0.1, Node.js 24.17.0, Android, arm64, and globally installed libvips. ## Additional context The repository was up to date with main matching origin/main. The issue reportedly occurs with NovelAI and image providers through OpenRouter or NanoGPT, but only when sending the character card image as a reference; generation without that reference works. The same workflow worked before v2.3.3. sharp has no prebuilt binary for android-arm64 and its source build expects an Android NDK environment that is not available or configured in Termux. Discord thread: [Bug] NovelAI Precise Reference unavailable on Termux Android due to sharp native module failure Discord thread link: https://discord.com/channels/1417099416812392641/1529786223143551017 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (2 messages)</summary> ```text [2026-07-23T09:44:17.651Z] Ozy: Hey, since v2.3.3 I can't generate illustrations nor sprites due to sharp native module. It happens using NAI or an image provider through OR or NanoGPT. I used OpenAi to troubleshoot but it didn't worked so I asked him to make a summary for you. Here's the summary: Environment Project: Marinara Engine Version tested: v2.3.3 OS: Android 12 Device: Samsung Galaxy S10e (arm64-v8a) Runtime: Termux (F-Droid) Node.js: v24.17.0 npm: 11.17.0 Description When using NovelAI image generation with Precise Reference Images, Marinara fails with: NovelAI precise reference images require server image preprocessing, but the optional sharp dependency is unavailable. The feature cannot be used because the server-side image preprocessing dependency (sharp) fails to load. Initial diagnosis The repository is up to date (main matches origin/main). sharp was initially missing. Installing sharp@0.34.5 succeeds, but the native module cannot load on Android. Initial runtime error: Could not load the "sharp" module using the android-arm64 runtime Troubleshooting performed Installed: sharp@0.34.5 libvips from Termux repositories (v8.18.4-2) clang make python node-gyp node-addon-api Added node-gyp as a development dependency. Attempted rebuild: cd ~/Marinara-Engine/packages/server node /data/data/com.termux/files/usr/lib/node_modules/pnpm/bin/pnpm.mjs rebuild sharp The build process now starts correctly: sharp: Attempting to build from source via node-gyp sharp: Found node-addon-api 8.9.0 sharp: Found node-gyp 13.0.1 sharp: Detected globally-installed libvips gyp info using node-gyp@13.0.1 gyp info using node@24.17.0 | android | arm64 However, it fails with: gyp: Undefined variable android_ndk_path in binding.gyp Conclusion sharp does not provide a prebuilt binary for the android-arm64 runtime, so it attempts a source build. The build fails because the Android NDK environment expected by node-gyp is not available/configured in Termux. Thank you. [Discord message: https://discord.com/channels/1417099416812392641/1529786223143551017/1529786223143551017] [2026-07-23T09:49:45.110Z] Ozy: I'd also like to precise that it only happens when trying to send the character card image as reference, otherwise it works fine. Before 2.3.3, everything worked fine. [Discord message: https://discord.com/channels/1417099416812392641/1529786223143551017/1529787596606275674] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:45:46 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2149
No description provided.