StackBlitz Preview Blank or Install Stalled: Diagnosing WebContainer Failures
A blank preview or stalled install in StackBlitz usually means the WebContainer runtime failed to boot, not that your code is broken. Classify the failure by stage, then apply the matching fix.
01 Jun 2026, 11:02 UTC

If a StackBlitz project opens, the file tree and editor render, but the preview pane stays blank or the terminal hangs partway through an install, the problem is usually the WebContainer runtime rather than the project's source. WebContainer is StackBlitz's in-browser Node.js runtime: it runs the dev server and package install inside the browser tab instead of on a remote machine. When it cannot boot, nothing downstream works, so the fastest path is to classify the failure by stage before editing any code.
The takeaway: reproduce outside any iframe in a supported Chromium-based desktop browser, read the terminal to decide whether the failure is boot, install, or runtime, and only then apply a fix. Many "my code is broken" reports turn out to be an environment or embedding problem.
The recognizable condition
Three variants of the same symptom:
- The editor shell loads, but the preview stays blank or shows a loading state indefinitely.
- The terminal starts but stalls during dependency installation.
- A runtime error appears after boot, often naming a native module or a missing binary.
All three point at the runtime environment. Source-code bugs generally appear after the runtime is up and the dev server is serving.
Cause-to-check table
| Stage | Likely cause | First check |
|---|---|---|
| Boot | Unsupported browser engine or in-app webview | Open the same project in a Chromium-based desktop browser, in a normal tab |
| Boot | Cross-origin isolation or SharedArrayBuffer unavailable | Check crossOriginIsolated and SharedArrayBuffer in the console |
| Boot | iframe sandbox or host CSP blocks the runtime | Open the project URL directly, outside the embed |
| Install | Registry or proxy unreachable, or lockfile mismatch | Read the terminal output; try a minimal template |
| Install | Private registry needs credentials | Confirm auth is configured for the runtime environment |
| Runtime | Dependency needs native binaries or child processes | Identify the package; test a pure-JavaScript equivalent |
| Runtime | Pinned Node version incompatible with a dependency | Compare the pin with the dependency's stated support range |
| Embed only | SDK version or embed call mismatch | Compare against current embed documentation |
Ordered checks
- Reproduce in a plain tab. Open the project URL directly, not the embedded iframe, in an incognito window with extensions disabled. Extensions that inject scripts or block workers can interfere. If it works here but not in the embed, the fault is in the embedding page.
- Confirm the host is supported. WebContainers have historically required a Chromium-class desktop browser. Do not assume parity with Firefox, Safari, mobile browsers, or in-app webviews. Check the current supported-browser matrix rather than relying on memory; this is version-sensitive.
- Read the terminal and classify the stage. Boot failures produce no install output at all. Install failures show the package manager starting and then stopping. Runtime failures show a completed install and a dev server that starts and then errors. The stage determines which fix applies.
- Load a minimal official template. If a minimal template also fails in the same browser, the environment is at fault. If it succeeds, the failure is specific to the project's dependencies or configuration.
- Inspect the host page's CSP and iframe attributes. A restrictive Content-Security-Policy or a sandbox attribute set can prevent the runtime from starting. Check whether the iframe is granted the permissions the runtime needs and whether same-origin access is allowed. Confirm exact requirements in current documentation before changing production headers.
- Confirm the embed SDK version and call. Embed APIs change. If the embed call was written against an older SDK, it may still render the editor while failing to start the runtime.
Fixes tied to findings
Boot failure
Move to a supported Chromium-based desktop browser and open the project outside the iframe. If the embed must stay, adjust the host page's CSP and iframe permissions, or switch to the SDK's documented embed method. Verify cross-origin isolation in the console:
// Run in the browser console of the failing tab
crossOriginIsolated; // expected true on a working host
typeof SharedArrayBuffer; // expected "function" on a working host
If either value is wrong, a boot-stage failure is likely. Treat the expected values as a diagnostic signal rather than a guarantee, and confirm them against current documentation.
Install failure
If the terminal shows the package manager starting and then stopping, check registry reachability and any proxy configuration in the runtime environment. A lockfile generated against a different registry, or a private package without credentials, will fail here. Try installing a single public package in a minimal template to separate network faults from lockfile faults.
Native module or child-process error
Packages that compile native binaries or spawn child processes may not run in a browser-based runtime. Replace the dependency with a pure-JavaScript equivalent if one exists, or move that workload to a server-side environment and keep the StackBlitz project for the client side only. To confirm the cause, test the pure-JavaScript replacement in the same project: if install and the dev server succeed, the original dependency was the problem.
Embed-only failure
If the project works in a plain tab but not in the iframe, the host page is the variable. Review CSP, sandbox, and permission attributes, and confirm the embed call matches the current SDK. Keep a fallback link that opens the project in a full tab.
Client-only template or WebContainer?
Use a client-only template when the demo needs no server runtime: a framework starter that builds and runs entirely in the browser, with no npm install step and no dev server. Reserve WebContainers for projects that genuinely need Node, package installation, or a dev server. Treat the embed as progressive enhancement: if the runtime fails, the reader should still be able to open the project in a full tab rather than seeing a blank pane.
Escalation criteria
- A minimal official template fails identically in two supported browsers and on two different networks.
- The terminal reports an internal WebContainer error rather than a project-level error.
- A production embed is blocked and no documented workaround applies.
When escalating, include the project ID, browser and OS versions, timestamps, and the full console and terminal output. Classify the failure by stage rather than quoting an error string, since messages are not stable identifiers.
Limitations and how to check the result
Browser support, supported Node versions, and the embed SDK API are version-sensitive and have changed over time. Hosted-service limits and embed restrictions are vendor-controlled and can change without notice. This guide describes a diagnostic approach, not a tested configuration.
To check a fix: load a minimal official template in a supported Chromium-based desktop browser and confirm the preview and terminal behave as expected; that is your known-good baseline. Then re-run the failing project in an incognito window with extensions disabled and outside any iframe. If it now works, the fix addressed the environment. If it still fails, the fault is in the project's dependencies or configuration.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.