Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: surface real AppImage failure causes from build target, not error text

Tw9372d3bf49b64a
diff --git a/bin/builders/BaseBuilder.ts b/bin/builders/BaseBuilder.ts
index c8a6f27c..7abd3308 100644
--- a/bin/builders/BaseBuilder.ts
+++ b/bin/builders/BaseBuilder.ts
@@ -24,8 +24,8 @@ import {
getBuildTimeout,
getInstallCommand,
getInstallTimeout,
- isLinuxDeployStripError,
} from './env';
+import { appendAppImageGuidance } from '@/utils/linuxBuildError';
export default abstract class BaseBuilder {
protected options: PakeAppOptions;
@@ -156,18 +156,15 @@ export default abstract class BaseBuilder {
const resolveExecEnv = () =>
Object.keys(buildEnv).length > 0 ? buildEnv : undefined;
- // Warn users about potential AppImage build failures on modern Linux systems.
- // The linuxdeploy tool bundled in Tauri uses an older strip tool that doesn't
- // recognize the .relr.dyn section introduced in glibc 2.38+.
- if (process.platform === 'linux' && target === 'appimage') {
- if (!buildEnv.NO_STRIP) {
- logger.warn(
- '⚠ Building AppImage on Linux may fail due to strip incompatibility with glibc 2.38+',
- );
- logger.warn(
- '⚠ If build fails, retry with: NO_STRIP=1 pake <url> --targets appimage',
- );
- }
+ const isLinuxAppImage =
+ process.platform === 'linux' && target === 'appimage';
+
+ // AppImage builds can fail at the linuxdeploy strip step on glibc 2.38+.
+ // A real failure now prints full guidance, so only hint in debug mode.
+ if (isLinuxAppImage && !buildEnv.NO_STRIP && this.options.debug) {
+ logger.warn(
+ '⚠ AppImage strip step can fail on glibc 2.38+; Pake will auto-retry with NO_STRIP=1.',
+ );
}
const buildCommand = `cd "${npmDirectory}" && ${this.getBuildCommand(packageManager)}`;
@@ -176,23 +173,26 @@ export default abstract class BaseBuilder {
try {
await shellExec(buildCommand, buildTimeout, resolveExecEnv());
} catch (error) {
- const shouldRetryWithoutStrip =
- process.platform === 'linux' &&
- target === 'appimage' &&
- !buildEnv.NO_STRIP &&
- isLinuxDeployStripError(error);
+ if (!isLinuxAppImage) {
+ throw error;
+ }
- if (shouldRetryWithoutStrip) {
- logger.warn(
- '⚠ AppImage build failed during linuxdeploy strip step, retrying with NO_STRIP=1 automatically.',
- );
- buildEnv = {
- ...buildEnv,
- NO_STRIP: '1',
- };
+ // linuxdeploy's diagnostics stream to the terminal (stdio: 'inherit') and
+ // never reach error.message, so we cannot classify the cause. strip is the
+ // most common AppImage failure, so retry once with NO_STRIP=1; if that
+ // (or an already-NO_STRIP run) still fails, surface all known causes.
+ if (buildEnv.NO_STRIP) {
+ throw appendAppImageGuidance(error);
+ }
+
+ logger.warn(
+ '⚠ AppImage build failed, retrying once with NO_STRIP=1 (common glibc 2.38+ strip issue).',
+ );
+ buildEnv = { ...buildEnv, NO_STRIP: '1' };
+ try {
await shellExec(buildCommand, buildTimeout, resolveExecEnv());
- } else {
- throw error;
+ } catch (retryError) {
+ throw appendAppImageGuidance(retryError);
}
}
diff --git a/bin/builders/env.ts b/bin/builders/env.ts
index 033a2b46..8b5b5780 100644
--- a/bin/builders/env.ts
+++ b/bin/builders/env.ts
@@ -204,30 +204,3 @@ export async function configureCargoRegistry(
);
}
}
-
-/**
- * Returns true when an error string looks like the well-known Tauri+linuxdeploy
- * strip failure that we automatically retry with NO_STRIP=1.
- */
-export function isLinuxDeployStripError(error: unknown): boolean {
- if (!(error instanceof Error) || !error.message) {
- return false;
- }
- const message = error.message.toLowerCase();
- // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy but is not a
- // strip issue, so a NO_STRIP retry won't help. Don't treat it as one.
- if (
- message.includes('gdk-pixbuf') ||
- message.includes('failed to run plugin: gtk')
- ) {
- return false;
- }
- return (
- message.includes('linuxdeploy') ||
- message.includes('failed to run linuxdeploy') ||
- message.includes('strip:') ||
- message.includes('unable to recognise the format of the input file') ||
- message.includes('appimage tool failed') ||
- message.includes('strip tool')
- );
-}
diff --git a/bin/utils/linuxBuildError.ts b/bin/utils/linuxBuildError.ts
new file mode 100644
index 00000000..06dc10a2
--- /dev/null
+++ b/bin/utils/linuxBuildError.ts
@@ -0,0 +1,35 @@
+const DIVIDER = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
+
+// Guidance printed after a Linux AppImage build fails for good. We cannot detect
+// the exact cause: linuxdeploy streams its diagnostics to the terminal via
+// `stdio: 'inherit'`, so they never reach `error.message` (which only holds the
+// failed command line). We only reach here after NO_STRIP=1 has already been
+// applied and still failed, so strip is presented as already ruled out.
+const APPIMAGE_FAILURE_GUIDANCE =
+ `\n\n${DIVIDER}\n` +
+ 'Linux AppImage Build Failed\n' +
+ `${DIVIDER}\n\n` +
+ 'The AppImage bundler (linuxdeploy) failed. Common causes and fixes:\n\n' +
+ ' • Strip incompatibility (glibc 2.38+): NO_STRIP=1 was already applied and\n' +
+ ' the build still failed, so strip is likely not the cause.\n' +
+ ' • Missing gdk-pixbuf loaders (e.g. "cannot stat\n' +
+ " '/usr/lib/gdk-pixbuf-2.0/...'\"): install them, then rebuild:\n" +
+ ' Arch: sudo pacman -S gdk-pixbuf2 librsvg\n' +
+ ' Debian: sudo apt install librsvg2-common gdk-pixbuf2.0-bin\n' +
+ ' Fedora: sudo dnf install gdk-pixbuf2-modules librsvg2\n' +
+ ' then: gdk-pixbuf-query-loaders --update-cache\n' +
+ ' • Running in Docker/container: AppImage needs /dev/fuse:\n' +
+ ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n\n' +
+ 'Still stuck? Build a DEB instead: pake <url> --targets deb\n' +
+ 'Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
+ DIVIDER;
+
+/**
+ * Returns the original error with AppImage guidance appended to its message,
+ * preserving the stack. Used when a Linux AppImage build fails for good.
+ */
+export function appendAppImageGuidance(error: unknown): Error {
+ const baseError = error instanceof Error ? error : new Error(String(error));
+ baseError.message += APPIMAGE_FAILURE_GUIDANCE;
+ return baseError;
+}
diff --git a/bin/utils/shell.ts b/bin/utils/shell.ts
index 64c1e1e7..1c87d83f 100644
--- a/bin/utils/shell.ts
+++ b/bin/utils/shell.ts
@@ -27,79 +27,11 @@ export async function shellExec(
);
}
- let errorMsg = `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`;
-
- // Provide targeted guidance for common Linux AppImage build failures.
- // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy/appimage but
- // is unrelated to strip, so it must be matched first and given its own hint.
- const lowerError = errorMessage.toLowerCase();
- const divider =
- '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
-
- if (process.platform === 'linux') {
- const isGtkPixbufFailure =
- lowerError.includes('gdk-pixbuf') ||
- lowerError.includes('failed to run plugin: gtk');
- const isAppImageStripFailure =
- lowerError.includes('linuxdeploy') ||
- lowerError.includes('appimage') ||
- lowerError.includes('strip');
- const noStripActive = !!(env?.NO_STRIP || process.env.NO_STRIP);
-
- if (isGtkPixbufFailure) {
- errorMsg +=
- `\n\n${divider}\n` +
- 'Linux AppImage Build Failed\n' +
- `${divider}\n\n` +
- "Cause: linuxdeploy's gtk plugin could not find the gdk-pixbuf loaders\n" +
- ' (e.g. "cannot stat \'/usr/lib/gdk-pixbuf-2.0/...\'").\n\n' +
- 'Quick fix:\n' +
- ' • Install the gdk-pixbuf loaders for your distro:\n' +
- ' Arch: sudo pacman -S gdk-pixbuf2 librsvg\n' +
- ' Debian: sudo apt install librsvg2-common gdk-pixbuf2.0-bin\n' +
- ' Fedora: sudo dnf install gdk-pixbuf2-modules librsvg2\n' +
- ' • Refresh the loader cache, then rebuild:\n' +
- ' gdk-pixbuf-query-loaders --update-cache\n\n' +
- 'Alternative:\n' +
- ' • Use DEB format instead: pake <url> --targets deb\n' +
- ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
- divider;
- } else if (isAppImageStripFailure) {
- errorMsg +=
- `\n\n${divider}\n` +
- 'Linux AppImage Build Failed\n' +
- `${divider}\n\n` +
- 'Cause: Strip tool incompatibility with glibc 2.38+\n' +
- ' (affects Debian Trixie, Arch Linux, and other modern distros)\n\n';
-
- errorMsg += noStripActive
- ? 'NO_STRIP=1 is already set but the build still failed, so this is\n' +
- 'likely not a strip issue. Try the alternatives below or rerun with\n' +
- '--debug and read the linuxdeploy output above for the real cause.\n\n'
- : 'Quick fix:\n' +
- ' NO_STRIP=1 pake <url> --targets appimage --debug\n\n';
-
- errorMsg +=
- 'Alternatives:\n' +
- ' • Use DEB format: pake <url> --targets deb\n' +
- ' • Update binutils: sudo apt install binutils (or pacman -S binutils)\n' +
- ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
- divider;
-
- if (
- lowerError.includes('fuse') ||
- lowerError.includes('operation not permitted') ||
- lowerError.includes('/dev/fuse')
- ) {
- errorMsg +=
- '\n\nDocker / Container hint:\n' +
- ' AppImage tooling needs access to /dev/fuse. When running inside Docker, add:\n' +
- ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n' +
- ' or run on the host directly.';
- }
- }
- }
-
- throw new Error(errorMsg);
+ // AppImage/linuxdeploy guidance is added by the caller (BaseBuilder), which
+ // knows the build target. We only have the command line here (the tool's
+ // diagnostics stream to the terminal via stdio:inherit, not into the error).
+ throw new Error(
+ `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`,
+ );
}
}
diff --git a/dist/cli.js b/dist/cli.js
index 01dd1c61..ba865e30 100644
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -248,69 +248,10 @@ async function shellExec(command, timeout = 300000, env) {
if (error.timedOut) {
throw new Error(`Command timed out after ${timeout}ms: "${command}". Try increasing timeout or check network connectivity.`);
}
- let errorMsg = `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`;
- // Provide targeted guidance for common Linux AppImage build failures.
- // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy/appimage but
- // is unrelated to strip, so it must be matched first and given its own hint.
- const lowerError = errorMessage.toLowerCase();
- const divider = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
- if (process.platform === 'linux') {
- const isGtkPixbufFailure = lowerError.includes('gdk-pixbuf') ||
- lowerError.includes('failed to run plugin: gtk');
- const isAppImageStripFailure = lowerError.includes('linuxdeploy') ||
- lowerError.includes('appimage') ||
- lowerError.includes('strip');
- const noStripActive = !!(env?.NO_STRIP || process.env.NO_STRIP);
- if (isGtkPixbufFailure) {
- errorMsg +=
- `\n\n${divider}\n` +
- 'Linux AppImage Build Failed\n' +
- `${divider}\n\n` +
- "Cause: linuxdeploy's gtk plugin could not find the gdk-pixbuf loaders\n" +
- ' (e.g. "cannot stat \'/usr/lib/gdk-pixbuf-2.0/...\'").\n\n' +
- 'Quick fix:\n' +
- ' • Install the gdk-pixbuf loaders for your distro:\n' +
- ' Arch: sudo pacman -S gdk-pixbuf2 librsvg\n' +
- ' Debian: sudo apt install librsvg2-common gdk-pixbuf2.0-bin\n' +
- ' Fedora: sudo dnf install gdk-pixbuf2-modules librsvg2\n' +
- ' • Refresh the loader cache, then rebuild:\n' +
- ' gdk-pixbuf-query-loaders --update-cache\n\n' +
- 'Alternative:\n' +
- ' • Use DEB format instead: pake <url> --targets deb\n' +
- ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
- divider;
- }
- else if (isAppImageStripFailure) {
- errorMsg +=
- `\n\n${divider}\n` +
- 'Linux AppImage Build Failed\n' +
- `${divider}\n\n` +
- 'Cause: Strip tool incompatibility with glibc 2.38+\n' +
- ' (affects Debian Trixie, Arch Linux, and other modern distros)\n\n';
- errorMsg += noStripActive
- ? 'NO_STRIP=1 is already set but the build still failed, so this is\n' +
- 'likely not a strip issue. Try the alternatives below or rerun with\n' +
- '--debug and read the linuxdeploy output above for the real cause.\n\n'
- : 'Quick fix:\n' +
- ' NO_STRIP=1 pake <url> --targets appimage --debug\n\n';
- errorMsg +=
- 'Alternatives:\n' +
- ' • Use DEB format: pake <url> --targets deb\n' +
- ' • Update binutils: sudo apt install binutils (or pacman -S binutils)\n' +
- ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
- divider;
- if (lowerError.includes('fuse') ||
- lowerError.includes('operation not permitted') ||
- lowerError.includes('/dev/fuse')) {
- errorMsg +=
- '\n\nDocker / Container hint:\n' +
- ' AppImage tooling needs access to /dev/fuse. When running inside Docker, add:\n' +
- ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n' +
- ' or run on the host directly.';
- }
- }
- }
- throw new Error(errorMsg);
+ // AppImage/linuxdeploy guidance is added by the caller (BaseBuilder), which
+ // knows the build target. We only have the command line here (the tool's
+ // diagnostics stream to the terminal via stdio:inherit, not into the error).
+ throw new Error(`Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`);
}
}
@@ -951,27 +892,38 @@ async function configureCargoRegistry(tauriSrcPath, useCnMirror) {
logger.warn(`✼ ${projectConf} still references rsproxy.cn. Remove it or set ${CN_MIRROR_ENV}=1 if you want to use the CN mirror.`);
}
}
+
+const DIVIDER = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
+// Guidance printed after a Linux AppImage build fails for good. We cannot detect
+// the exact cause: linuxdeploy streams its diagnostics to the terminal via
+// `stdio: 'inherit'`, so they never reach `error.message` (which only holds the
+// failed command line). We only reach here after NO_STRIP=1 has already been
+// applied and still failed, so strip is presented as already ruled out.
+const APPIMAGE_FAILURE_GUIDANCE = `\n\n${DIVIDER}\n` +
+ 'Linux AppImage Build Failed\n' +
+ `${DIVIDER}\n\n` +
+ 'The AppImage bundler (linuxdeploy) failed. Common causes and fixes:\n\n' +
+ ' • Strip incompatibility (glibc 2.38+): NO_STRIP=1 was already applied and\n' +
+ ' the build still failed, so strip is likely not the cause.\n' +
+ ' • Missing gdk-pixbuf loaders (e.g. "cannot stat\n' +
+ " '/usr/lib/gdk-pixbuf-2.0/...'\"): install them, then rebuild:\n" +
+ ' Arch: sudo pacman -S gdk-pixbuf2 librsvg\n' +
+ ' Debian: sudo apt install librsvg2-common gdk-pixbuf2.0-bin\n' +
+ ' Fedora: sudo dnf install gdk-pixbuf2-modules librsvg2\n' +
+ ' then: gdk-pixbuf-query-loaders --update-cache\n' +
+ ' • Running in Docker/container: AppImage needs /dev/fuse:\n' +
+ ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n\n' +
+ 'Still stuck? Build a DEB instead: pake <url> --targets deb\n' +
+ 'Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
+ DIVIDER;
/**
- * Returns true when an error string looks like the well-known Tauri+linuxdeploy
- * strip failure that we automatically retry with NO_STRIP=1.
+ * Returns the original error with AppImage guidance appended to its message,
+ * preserving the stack. Used when a Linux AppImage build fails for good.
*/
-function isLinuxDeployStripError(error) {
- if (!(error instanceof Error) || !error.message) {
- return false;
- }
- const message = error.message.toLowerCase();
- // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy but is not a
- // strip issue, so a NO_STRIP retry won't help. Don't treat it as one.
- if (message.includes('gdk-pixbuf') ||
- message.includes('failed to run plugin: gtk')) {
- return false;
- }
- return (message.includes('linuxdeploy') ||
- message.includes('failed to run linuxdeploy') ||
- message.includes('strip:') ||
- message.includes('unable to recognise the format of the input file') ||
- message.includes('appimage tool failed') ||
- message.includes('strip tool'));
+function appendAppImageGuidance(error) {
+ const baseError = error instanceof Error ? error : new Error(String(error));
+ baseError.message += APPIMAGE_FAILURE_GUIDANCE;
+ return baseError;
}
class BaseBuilder {
@@ -1065,14 +1017,11 @@ class BaseBuilder {
...(process.env.NO_STRIP ? { NO_STRIP: process.env.NO_STRIP } : {}),
};
const resolveExecEnv = () => Object.keys(buildEnv).length > 0 ? buildEnv : undefined;
- // Warn users about potential AppImage build failures on modern Linux systems.
- // The linuxdeploy tool bundled in Tauri uses an older strip tool that doesn't
- // recognize the .relr.dyn section introduced in glibc 2.38+.
- if (process.platform === 'linux' && target === 'appimage') {
- if (!buildEnv.NO_STRIP) {
- logger.warn('⚠ Building AppImage on Linux may fail due to strip incompatibility with glibc 2.38+');
- logger.warn('⚠ If build fails, retry with: NO_STRIP=1 pake <url> --targets appimage');
- }
+ const isLinuxAppImage = process.platform === 'linux' && target === 'appimage';
+ // AppImage builds can fail at the linuxdeploy strip step on glibc 2.38+.
+ // A real failure now prints full guidance, so only hint in debug mode.
+ if (isLinuxAppImage && !buildEnv.NO_STRIP && this.options.debug) {
+ logger.warn('⚠ AppImage strip step can fail on glibc 2.38+; Pake will auto-retry with NO_STRIP=1.');
}
const buildCommand = `cd "${npmDirectory}" && ${this.getBuildCommand(packageManager)}`;
const buildTimeout = getBuildTimeout();
@@ -1080,20 +1029,23 @@ class BaseBuilder {
await shellExec(buildCommand, buildTimeout, resolveExecEnv());
}
catch (error) {
- const shouldRetryWithoutStrip = process.platform === 'linux' &&
- target === 'appimage' &&
- !buildEnv.NO_STRIP &&
- isLinuxDeployStripError(error);
- if (shouldRetryWithoutStrip) {
- logger.warn('⚠ AppImage build failed during linuxdeploy strip step, retrying with NO_STRIP=1 automatically.');
- buildEnv = {
- ...buildEnv,
- NO_STRIP: '1',
- };
+ if (!isLinuxAppImage) {
+ throw error;
+ }
+ // linuxdeploy's diagnostics stream to the terminal (stdio: 'inherit') and
+ // never reach error.message, so we cannot classify the cause. strip is the
+ // most common AppImage failure, so retry once with NO_STRIP=1; if that
+ // (or an already-NO_STRIP run) still fails, surface all known causes.
+ if (buildEnv.NO_STRIP) {
+ throw appendAppImageGuidance(error);
+ }
+ logger.warn('⚠ AppImage build failed, retrying once with NO_STRIP=1 (common glibc 2.38+ strip issue).');
+ buildEnv = { ...buildEnv, NO_STRIP: '1' };
+ try {
await shellExec(buildCommand, buildTimeout, resolveExecEnv());
}
- else {
- throw error;
+ catch (retryError) {
+ throw appendAppImageGuidance(retryError);
}
}
// Copy app
diff --git a/docs/faq.md b/docs/faq.md
index 4c81dedf..c42214af 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -108,6 +108,22 @@ When building AppImage on Linux (Debian, Ubuntu, Arch, etc.), you may encounter
```txt
Error: failed to run linuxdeploy
Error: strip: Unable to recognise the format of the input file
+ERROR: Failed to run plugin: gtk
+cp: cannot stat '/usr/lib/gdk-pixbuf-2.0/2.10.0': No such file or directory
+```
+
+**Identify which failure you have first.** Two distinct problems share the `failed to run linuxdeploy` message:
+
+- `strip: Unable to recognise the format of the input file`: a strip incompatibility. Use Solution 1.
+- `Failed to run plugin: gtk` together with `cannot stat '/usr/lib/gdk-pixbuf-2.0/...'`: linuxdeploy's gtk plugin cannot find the gdk-pixbuf loaders. `NO_STRIP` will not help. Install the loaders, refresh the cache, then rebuild:
+
+```bash
+# Arch
+sudo pacman -S gdk-pixbuf2 librsvg
+# Debian / Ubuntu
+sudo apt install librsvg2-common gdk-pixbuf2.0-bin
+# refresh the loader cache, then rebuild
+gdk-pixbuf-query-loaders --update-cache
```
**Solution 1: Automatic NO_STRIP Retry (Recommended)**
diff --git a/docs/faq_CN.md b/docs/faq_CN.md
index d1c56c6d..401a3fbb 100644
--- a/docs/faq_CN.md
+++ b/docs/faq_CN.md
@@ -108,6 +108,22 @@ sudo apt-get install -y libayatana-appindicator3-dev
```txt
Error: failed to run linuxdeploy
Error: strip: Unable to recognise the format of the input file
+ERROR: Failed to run plugin: gtk
+cp: cannot stat '/usr/lib/gdk-pixbuf-2.0/2.10.0': No such file or directory
+```
+
+**先判断你遇到的是哪一种失败。** 同样是 `failed to run linuxdeploy`,实际有两类不同原因:
+
+- `strip: Unable to recognise the format of the input file`:strip 不兼容,按解决方案 1 处理。
+- `Failed to run plugin: gtk` 且伴随 `cannot stat '/usr/lib/gdk-pixbuf-2.0/...'`:linuxdeploy 的 gtk 插件找不到 gdk-pixbuf loaders,`NO_STRIP` 无效。安装 loaders、刷新缓存后重新构建:
+
+```bash
+# Arch
+sudo pacman -S gdk-pixbuf2 librsvg
+# Debian / Ubuntu
+sudo apt install librsvg2-common gdk-pixbuf2.0-bin
+# 刷新 loader 缓存后重新构建
+gdk-pixbuf-query-loaders --update-cache
```
**解决方案 1:自动 NO_STRIP 重试(推荐)**
diff --git a/tests/unit/linux-build-error.test.ts b/tests/unit/linux-build-error.test.ts
new file mode 100644
index 00000000..d6bbad8b
--- /dev/null
+++ b/tests/unit/linux-build-error.test.ts
@@ -0,0 +1,26 @@
+import { describe, it, expect } from 'vitest';
+import { appendAppImageGuidance } from '@/utils/linuxBuildError';
+
+describe('appendAppImageGuidance', () => {
+ it('appends guidance listing every known cause and the deb fallback', () => {
+ const result = appendAppImageGuidance(new Error('boom'));
+ expect(result.message).toContain('boom'); // original message preserved
+ expect(result.message).toContain('Linux AppImage Build Failed');
+ expect(result.message).toContain('NO_STRIP=1 was already applied');
+ expect(result.message).toContain('gdk-pixbuf');
+ expect(result.message).toContain('/dev/fuse');
+ expect(result.message).toContain('--targets deb');
+ });
+
+ it('returns the same Error instance so the stack is preserved', () => {
+ const original = new Error('Command failed with exit code 1');
+ expect(appendAppImageGuidance(original)).toBe(original);
+ });
+
+ it('wraps non-Error throwables', () => {
+ const result = appendAppImageGuidance('raw string failure');
+ expect(result).toBeInstanceOf(Error);
+ expect(result.message).toContain('raw string failure');
+ expect(result.message).toContain('Linux AppImage Build Failed');
+ });
+});