tauri-apps/tauri · error

Unable to find your web assets, did you forget to build your

Error message

Unable to find your web assets, did you forget to build your web app? Your frontendDist is set to "{}" (which is `{}`).

What it means

When `build.frontendDist` is a directory, the CLI checks that it exists before bundling. A missing directory almost always means the frontend build that should produce it never ran — typically because `beforeBuildCommand` is unset, misconfigured, or points at the wrong script.

Source

Thrown at crates/tauri-cli/src/build.rs:219

  if let Some(before_build) = config.build.before_build_command.clone() {
    helpers::run_hook(
      "beforeBuildCommand",
      before_build,
      interface,
      options.debug,
      dirs.frontend,
    )?;
  }

  if let Some(FrontendDist::Directory(web_asset_path)) = &config.build.frontend_dist {
    if !web_asset_path.exists() {
      let absolute_path = web_asset_path
        .parent()
        .and_then(|p| p.canonicalize().ok())
        .map(|p| p.join(web_asset_path.file_name().unwrap()))
        .unwrap_or_else(|| std::env::current_dir().unwrap().join(web_asset_path));
      crate::error::bail!(
        "Unable to find your web assets, did you forget to build your web app? Your frontendDist is set to \"{}\" (which is `{}`).",
        web_asset_path.display(), absolute_path.display(),
      );
    }
    if web_asset_path
      .canonicalize()
      .fs_context("failed to canonicalize path", web_asset_path.to_path_buf())?
      .file_name()
      == Some(std::ffi::OsStr::new("src-tauri"))
    {
      crate::error::bail!(
          "The configured frontendDist is the `src-tauri` folder. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",
        );
    }

    // Issue #13287 - Allow the use of target dir inside frontendDist/distDir
    // https://github.com/tauri-apps/tauri/issues/13287
    let target_path = get_cargo_target_dir(&options.args, dirs.tauri)?;

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Build the frontend manually once (`npm run build` in the frontend dir) and confirm the output folder matches `frontendDist`
  2. Set `beforeBuildCommand` in `tauri.conf.json` to your frontend build script (e.g. `"beforeBuildCommand": "npm run build"`) so the CLI builds it for you
  3. Correct the `frontendDist` path if your bundler emits elsewhere (e.g. `../build` instead of `../dist`)

Example fix

// before (tauri.conf.json)
"build": { "frontendDist": "../dist" }   // and no beforeBuildCommand

// after
"build": {
  "beforeBuildCommand": "npm run build",
  "frontendDist": "../dist"
}
Defensive patterns

Strategy: validation

Validate before calling

# verify frontendDist exists before building
DIST=$(jq -r '.build.frontendDist' src-tauri/tauri.conf.json)
[ -d "src-tauri/$DIST" ] || { echo "frontendDist $DIST missing — run the frontend build first" >&2; exit 1; }
tauri build

Prevention

When it happens

Trigger: `tauri build` (or `tauri dev`) with `"frontendDist": "../dist"` when `dist/` does not exist: the frontend was never built, `beforeBuildCommand` is missing/misspelled in `tauri.conf.json`, or the frontend bundler outputs to a different directory.

Common situations: First build after scaffolding without a `beforeBuildCommand`; custom bundlers (vite/webpack) writing to `build/` while the config says `dist/`; CI caching that excludes the frontend output; running `tauri build` directly inside `src-tauri` with a relative `frontendDist` that resolves differently.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/fbe3fc6a36cd4bcf. Report an issue: GitHub.