# Could not find the web assets directory

> Getting the error “Could not find the web assets directory”? Here is how to fix it. Build the site first, or point webDir at that folder.

**Could not find the web assets directory.** npx cap sync copies the built website into the app, but the webDir folder doesn’t exist — the web build didn’t run, or writes somewhere else.

- Web build. Capacitor can’t find your web build.
- Interactive page: https://capwr.app/free-tools/build-error-explainer/could-not-find-the-web-assets-directory
- Build error explainer: https://capwr.app/free-tools/build-error-explainer
- Last updated: 2026-10-03

## What this error means

npx cap sync copies the built website into the app, but the webDir folder doesn’t exist — the web build didn’t run, or writes somewhere else.

## Why it happens

npx cap sync copies the folder named by webDir into the native projects. That folder is not there, because the web build did not run or wrote somewhere else.

## The message tools print

```
[error] Could not find the web assets directory: ./dist.
        Please create it and make sure it has an index.html file. You can change the path of this directory in capacitor.config.ts (webDir option).
```

## How to fix it

1. Run npm run build before npx cap sync.
2. Make webDir in capacitor.config match the folder the build writes: dist for Vite, build for Create React App, out for a Next.js export.

The [Capacitor appId and bundle ID validator](https://capwr.app/free-tools/capacitor-config-validator) checks the appId and webDir before you create store records.

## Check a log that shows this

Paste the failing step into the [build error explainer](https://capwr.app/free-tools/build-error-explainer). It matches this message, and any others in the same log, in your browser. Nothing is uploaded.

## Other Web build errors

- [npm ci needs an existing package-lock.json](https://capwr.app/free-tools/build-error-explainer/npm-ci-package-lock-json)
- [npm ci: lockfile is out of sync with package.json](https://capwr.app/free-tools/build-error-explainer/npm-ci-lockfile-out-of-sync)
- [npm ERESOLVE unable to resolve dependency tree](https://capwr.app/free-tools/build-error-explainer/npm-eresolve)
- [JavaScript heap out of memory](https://capwr.app/free-tools/build-error-explainer/javascript-heap-out-of-memory)
- [Rollup failed to resolve import](https://capwr.app/free-tools/build-error-explainer/rollup-failed-to-resolve-import)
- [error TS: TypeScript errors stop the build](https://capwr.app/free-tools/build-error-explainer/typescript-error-ts)
- [Capacitor: Invalid App ID](https://capwr.app/free-tools/build-error-explainer/invalid-app-id)

## Build the web app before the native one

CapWrapp installs dependencies from the lockfile, builds the site, and runs Capacitor sync before the native build, from the GitHub repo you connect.

[Get started free](https://capwr.app/login).

## About CapWrapp

CapWrapp turns a web app on GitHub — built with Lovable, Bolt, Base44, Cursor or by hand — into iPhone and Android apps. It adds Capacitor if the repo needs it, signs the builds, and ships them to TestFlight and Google Play from GitHub Actions, with no Mac or Xcode on your side. [Get started free](https://capwr.app/login) · [Lovable to App Store guide](https://capwr.app/guides/lovable-to-app-store)
