sveltejs/svelte · critical · Error
Your application, or one of its dependencies, imported from
Error message
Your application, or one of its dependencies, imported from 'svelte/internal', which was a private module used by Svelte 4 components that no longer exists in Svelte 5. It is not intended to be public API. If you're a library author and you used 'svelte/internal' deliberately, please raise an issue on https://github.com/sveltejs/svelte/issues detailing your use case.
What it means
Svelte 5 removed the private `svelte/internal` module that Svelte 4 used for compiled-component runtime helpers. The module now exists only to throw this error on import, directing library authors to file an issue. There is no public replacement: Svelte 5 internals live under `svelte/internal/client` and `svelte/internal/server` but remain private API.
Source
Thrown at packages/svelte/src/internal/index.js:3
// TODO we may, on a best-effort basis, reimplement some of the legacy private APIs here so that certain libraries continue to work. Those APIs will be marked as deprecated (and should noisily warn the user) and will be removed in a future version of Svelte. throw new Error( `Your application, or one of its dependencies, imported from 'svelte/internal', which was a private module used by Svelte 4 components that no longer exists in Svelte 5. It is not intended to be public API. If you're a library author and you used 'svelte/internal' deliberately, please raise an issue on https://github.com/sveltejs/svelte/issues detailing your use case.` );
View on GitHub (pinned to 20b341f100)
Solutions
- Find offending packages: `grep -rl "svelte/internal" node_modules --include="*.js"` and upgrade them to Svelte-5-compatible releases.
- Deduplicate Svelte: `npm ls svelte`, ensure a single 5.x version, run `npm dedupe` / `pnpm dedupe`.
- If you own the code, replace `svelte/internal` imports with the public `svelte` API (`onMount`, `getContext`, etc.) or `svelte/store`.
Example fix
// before (Svelte 4 private import)
import { onDestroy } from 'svelte/internal';
// after (Svelte 5 public API)
import { onDestroy } from 'svelte'; Defensive patterns
Strategy: validation
Validate before calling
// CI / postinstall check: fail if any dependency imports svelte/internal
const { execSync } = require('child_process');
try {
const out = execSync("grep -rl \"svelte/internal\" node_modules --include=*.js", { stdio: 'pipe' }).toString();
if (out.trim()) { console.error('A dependency imports svelte/internal:\n' + out); process.exit(1); }
} catch {} Prevention
- Pin svelte to a single 5.x version across the monorepo.
- Run `npm ls svelte` after upgrades to catch duplicates.
- Keep UI libraries on Svelte-5-compatible releases.
- Add a CI grep guard for `svelte/internal` imports.
When it happens
Trigger: Any code or dependency that does `import ... from 'svelte/internal'`. Common with Svelte 4-era libraries (UI kits, store utilities) that reached into internals for helpers like `onDestroy`, `getContext`, or DOM utilities.
Common situations: Upgrading a project from Svelte 4 to 5 while a dependency still ships Svelte-4-compiled code; a transitive dependency bundled against an old Svelte; duplicated `svelte` versions in node_modules resolving the wrong internal.
Related errors
- 'svelte/compiler' no longer exports a `walk` utility — pleas
- migrating this component would require adding a `$${rune}` r
- Can't migrate code with ${illegal_specifiers.join(' and ')}.
- Encountered an export declaration pattern that is not suppor
- $$props is used together with named props in a way that cann
AI-assisted analysis of sveltejs/svelte@20b341f100 (2026-08-12).
Data as JSON: /api/errors/e27c1bf1320e18fc.
Report an issue: GitHub.