slint-ui/slint · warning

[slint-ui] Could not load slint-ui-dev

Error message

[slint-ui] Could not load slint-ui-dev: ${error.message}

What it means

The slint-ui Node binding loader first tries the installed package and then falls back to requiring 'slint-ui-dev/loader' (a development build). If that dev package exists but fails to load for a reason other than simply not being installed (code !== MODULE_NOT_FOUND), the loader prints this warning and continues without the dev binding. The binding may then be missing entirely if the primary package also failed.

Solutions

  1. Remove node_modules/slint-ui-dev and reinstall, or run `npm rebuild slint-ui-dev` to rebuild the native binary for the current Node version
  2. Read the logged error.message to identify the real failure (e.g. NODE_MODULE_VERSION mismatch, missing .node file)
  3. Verify the platform optional dependency package (e.g. @slint-ui/<platform>) is installed and matches your OS/arch
  4. If you don't need the dev build, uninstall slint-ui-dev so the loader uses the published slint-ui package

Example fix

// before
npm install   # leaves stale slint-ui-dev binary after node upgrade
// after
rm -rf node_modules/slint-ui-dev && npm install
# or explicitly rebuild the native binding
npm rebuild slint-ui-dev
Defensive patterns

Strategy: fallback

Validate before calling

try { require('slint-ui-dev/loader'); devAvailable = true; } catch (e) { devAvailable = (e.code === 'MODULE_NOT_FOUND'); }

Type guard

function isModuleNotFoundError(e) {
  return e != null && typeof e === 'object' && e.code === 'MODULE_NOT_FOUND';
}

Try / catch

try {
  require('slint-ui/loader');
} catch (e) {
  try {
    require('slint-ui-dev/loader');
  } catch (devErr) {
    console.error('No usable slint binding:', devErr.message, 'code=', devErr.code);
  }
}

Prevention

When it happens

Trigger: Having slint-ui-dev present in node_modules but with a native binary built for a different Node ABI/platform, a corrupted install, or a broken loader module inside it; loading the binding after switching Node versions without rebuilding.

Common situations: Post node upgrade (NAPI/ABI mismatch), partial npm/pnpm installs, platform-specific optional dependencies not downloaded (npm install with --no-optional), or a stale dev build after `cargo clean`.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/ac6a95b5739764fd. Report an issue: GitHub.

Appendix: source

Thrown at api/node/binding.cjs:70

    const devRequested =
        !!process.env.SLINT_MCP_PORT || !!process.env.SLINT_TEST_SERVER;
    if (devRequested) {
        try {
            const devVersion = require("slint-ui-dev/package.json").version;
            const ownVersion = require("./package.json").version;
            if (devVersion !== ownVersion) {
                console.warn(
                    `[slint-ui] Ignoring slint-ui-dev ${devVersion}: it does not match ` +
                        `slint-ui ${ownVersion}. Install slint-ui-dev@${ownVersion} to enable ` +
                        `the development binary.`,
                );
            } else {
                return require("slint-ui-dev/loader");
            }
        } catch (error) {
            // Not installed, or its native binary is unavailable on this platform.
            if (error && error.code !== "MODULE_NOT_FOUND") {
                console.warn(
                    `[slint-ui] Could not load slint-ui-dev: ${error.message}`,
                );
            }
        }
    }

    // 3. Default release binary.
    return require("./rust-module.cjs");
}

module.exports = loadBinding();

View on GitHub (pinned to bb937076de)