{"record":{"id":"ac6a95b5739764fd","repo":"slint-ui/slint","slug":"slint-ui-could-not-load-slint-ui-dev-error-message","errorCode":null,"errorMessage":"[slint-ui] Could not load slint-ui-dev: ${error.message}","messagePattern":"\\[slint-ui\\] Could not load slint-ui-dev: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/node/binding.cjs","lineNumber":70,"sourceCode":"    const devRequested =\n        !!process.env.SLINT_MCP_PORT || !!process.env.SLINT_TEST_SERVER;\n    if (devRequested) {\n        try {\n            const devVersion = require(\"slint-ui-dev/package.json\").version;\n            const ownVersion = require(\"./package.json\").version;\n            if (devVersion !== ownVersion) {\n                console.warn(\n                    `[slint-ui] Ignoring slint-ui-dev ${devVersion}: it does not match ` +\n                        `slint-ui ${ownVersion}. Install slint-ui-dev@${ownVersion} to enable ` +\n                        `the development binary.`,\n                );\n            } else {\n                return require(\"slint-ui-dev/loader\");\n            }\n        } catch (error) {\n            // Not installed, or its native binary is unavailable on this platform.\n            if (error && error.code !== \"MODULE_NOT_FOUND\") {\n                console.warn(\n                    `[slint-ui] Could not load slint-ui-dev: ${error.message}`,\n                );\n            }\n        }\n    }\n\n    // 3. Default release binary.\n    return require(\"./rust-module.cjs\");\n}\n\nmodule.exports = loadBinding();\n","sourceCodeStart":52,"sourceCodeEnd":82,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/binding.cjs#L52-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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`.","solutions":["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","Read the logged error.message to identify the real failure (e.g. NODE_MODULE_VERSION mismatch, missing .node file)","Verify the platform optional dependency package (e.g. @slint-ui/<platform>) is installed and matches your OS/arch","If you don't need the dev build, uninstall slint-ui-dev so the loader uses the published slint-ui package"],"exampleFix":"// before\nnpm install   # leaves stale slint-ui-dev binary after node upgrade\n// after\nrm -rf node_modules/slint-ui-dev && npm install\n# or explicitly rebuild the native binding\nnpm rebuild slint-ui-dev","handlingStrategy":"fallback","validationCode":"try { require('slint-ui-dev/loader'); devAvailable = true; } catch (e) { devAvailable = (e.code === 'MODULE_NOT_FOUND'); }","typeGuard":"function isModuleNotFoundError(e) {\n  return e != null && typeof e === 'object' && e.code === 'MODULE_NOT_FOUND';\n}","tryCatchPattern":"try {\n  require('slint-ui/loader');\n} catch (e) {\n  try {\n    require('slint-ui-dev/loader');\n  } catch (devErr) {\n    console.error('No usable slint binding:', devErr.message, 'code=', devErr.code);\n  }\n}","preventionTips":["Rebuild native modules after upgrading Node (npm rebuild)","Keep optional platform dependencies enabled during install","Pin Node version (engines/.nvmrc) so native binaries match the runtime"],"tags":["nodejs","native-module","module-loading"],"backgroundTag":"module-init-failed","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}