# Troubleshooting (/docs/native/cli/troubleshooting)

<InstallTabs commands={[{ verb: "dlx", packages: ["delacour@latest doctor"] }]} />

```txt
✓ Expo             SDK ~58.0.16, react-native 0.88.0
✓ New Architecture enabled
✓ Uniwind          uniwind and tailwindcss installed
✓ Metro            wrapped, outermost, pointing at the configured entry
✗ Tailwind sources not scanned: src/components/ui
    → Classes in those files are dropped from release builds.
! Gesture Handler  no GestureHandlerRootView found
    → Wrap your root layout in <GestureHandlerRootView style={{ flex: 1 }}>.
```

Every check here exists because the thing it catches produces **no error**. A React Native app
with any of these wrong builds fine, boots fine, and is quietly wrong — which is why this command
exists at all and shadcn has no equivalent.

`--fast` skips the two checks that shell out to the Expo CLI. `--json` prints the results for CI;
the exit code is non-zero when a check fails.

## Symptom → cause [#symptom--cause]

### My components render, but with no styles [#my-components-render-but-with-no-styles]

Three causes, in the order worth checking.

**Nothing imports the CSS entry.** `withUniwindConfig`'s `cssEntryFile` tells the transformer which
file to compile — it does not put that file in the bundle. If no module imports it, the app builds,
boots and renders every component completely unstyled, with nothing logged.

```tsx title="app/_layout.tsx"
import "@/styles/global.css";
```

First statement, in the root layout. `delacour doctor` checks this, and is careful to ignore a doc
comment that merely names the import.

<Callout>
The signature is unmistakable once you have seen it: no padding, no gaps, no colours, and spinners
drawn at their natural SVG size rather than the icon scale. Every component is *mounting* — it is
only the classes that never arrived.
</Callout>

**Tailwind's `@source` coverage**, and usually only in a release build. Tailwind compiles the
classes it finds in source text, so a glob that does not reach your components means those classes
were never compiled.

In a monorepo, the usual cause is a `@source` pointing through `node_modules` — the scanner does
not follow symlinks, so it scans nothing. See [Monorepos](/docs/native/cli/monorepo).

The commands below use `npx`; `pnpm dlx`, `yarn dlx` and `bunx` work the same way.

```bash
npx delacour@latest doctor    # "Tailwind sources — not scanned: …"
npx delacour@latest init -f   # rewrites the managed @source block
```

**Metro's wrapper ordering.** If `withUniwindConfig` is present but not the **outermost** wrapper,
something applied after it can replace `config.transformer`, and `className` stops compiling
entirely. `doctor` checks the ordering, not just the presence.

### Light works, dark never arrives [#light-works-dark-never-arrives]

`theme.css` is still in shadcn's shape. A pasted `globals.css` declares its dark palette in a
`.dark { … }` block, and Uniwind reads that as a **utility class named `dark`** — no error, no
warning, and every dark value silently never reaches a component. Uniwind takes a theme only from
`@variant light` / `@variant dark`.

```bash
npx delacour@latest doctor    # "Theme tokens — theme.css is in shadcn's :root / .dark shape"
npx delacour@latest theme     # rewrites theme.css in place
```

The command also fills in the tokens shadcn has no name for — `--destructive-foreground` among
them, which shadcn v4 stopped declaring and which every destructive control here paints its label
with. See [Theming](/docs/native/getting-started/theming).

### Presses do nothing [#presses-do-nothing]

No `GestureHandlerRootView` above the component. Every pressable in this library is a Gesture
Handler detector, and a detector outside the root never receives a touch — no error, no warning.

```tsx title="app/_layout.tsx"
import { DelacourProvider } from "@/components/ui/provider";

export default function RootLayout() {
  return <DelacourProvider>{children}</DelacourProvider>;
}
```

### `Unable to resolve "@/components/ui/button"` [#unable-to-resolve-componentsuibutton]

Metro does not read `tsconfig` path mappings unless you ask it to:

```ts title="app.config.ts"
experiments: { tsconfigPaths: true }
```

`doctor` only raises this when `native-components.json` actually has aliases. If it does not, your imports
are relative and this is not your problem.

### A red box naming a module I just installed [#a-red-box-naming-a-module-i-just-installed]

A native module is not live until the app is rebuilt — a JavaScript reload cannot pick it up,
because the module is not in the binary. `add` warns when it installs one.

```bash
npx expo run:ios     # or run:android
```

### Something breaks only in a monorepo [#something-breaks-only-in-a-monorepo]

Two copies of a native module registering twice. `doctor` warns when it finds
`react-native-reanimated` (or friends) under both the app and the workspace root; pin them in
Metro's `resolver.extraNodeModules`.

### A worklet error, or Reanimated refusing to build [#a-worklet-error-or-reanimated-refusing-to-build]

Reanimated 4 is New Architecture only. `doctor` reads your resolved Expo config and fails if
`newArchEnabled` is off.

### `add` overwrote something I had edited [#add-overwrote-something-i-had-edited]

It asks first — unless you passed `--overwrite`, or ran non-interactively without it, in which
case it refuses and names the files. `--overwrite` is for taking the registry's copy on purpose. To
bring a component up to date and keep what you changed, use `update` instead:

<InstallTabs commands={[{ verb: "dlx", packages: ["delacour@latest update button"] }]} />

### `update` left conflict markers in a file [#update-left-conflict-markers-in-a-file]

You and the registry changed the same lines, and it will not guess between you. Open the file,
keep the side you want from each `<<<<<<< local` … `>>>>>>> registry` region, and delete the
markers. Nothing else needs doing — the lock already names the new registry text, so the next
`update` starts from there.

### `update` skipped a file "not in the lock" [#update-skipped-a-file-not-in-the-lock]

The file was copied in before the lock existed and no longer matches the registry, so there is
nothing to merge it from. At a terminal, `update` asks what to do with those files once the run is
done. Anywhere else, name the ref it came from with `--base <ref>`, or take the registry's copy
with `add <name> --overwrite`.

### `native-components.json` predates options, or doctor warns on Config version [#native-componentsjson-predates-options-or-doctor-warns-on-config-version]

The file was written by an older CLI, so options added since have no answer in it. Run
`npx delacour@latest update` at a terminal: it asks about each one once and records the new
`version`. Under `--yes` it keeps the defaults instead. See
[Updating `native-components.json`](/docs/native/cli/updating#updating-native-componentsjson).

### The registry does not have a component I can see on this site [#the-registry-does-not-have-a-component-i-can-see-on-this-site]

Your CLI is pinned to the ref it was published from. Take the newest:

<InstallTabs commands={[{ verb: "dlx", packages: ["delacour@latest add tabs --ref main"] }]} />

See [The registry](/docs/native/cli/registry).

### Every `className` is a type error in a monorepo [#every-classname-is-a-type-error-in-a-monorepo]

```
Type '{ children: Element; className: string; … }' is not assignable to type
  'IntrinsicAttributes & Omit<AnimatedProps<Readonly<ViewProps>>, "ref">'
```

`uniwind-env.d.ts` is one line — `/// <reference types="uniwind/types" />` — and it is what gives a
React Native component a `className` prop in TypeScript at all. In a shared package it lands beside
the components, **outside the app's `tsconfig` include**, and nothing imports it: a declaration file
holding only a triple-slash reference cannot be reached by an import. So the augmentation never
loads for the app.

`init` writes a copy into the app for you, and `doctor` fails when it is missing. If you are
adopting a package by hand, add it yourself:

```ts title="apps/mobile/uniwind-env.d.ts"
/// <reference types="uniwind/types" />
```

### `Ref<never>`, or two copies of React Native's types [#refnever-or-two-copies-of-react-natives-types]

```
Type 'Ref<never> | undefined' is not assignable to type 'AnimatedComponentRef<typeof View>'
```

A Bun workspace installing with the default isolated layout. Packages sit under
`node_modules/.bun/…` and are linked from each package, so the shared package resolves React Native
at a different realpath than the app — TypeScript treats them as different modules and generics
collapse to `never`. Metro cannot follow that layout either.

```toml title="bunfig.toml"
[install]
linker = "hoisted"
```

### `Must use import to load ES Module` under Jest [#must-use-import-to-load-es-module-under-jest]

A suite reached `chart` or `bottom-sheet`, whose engines ship TypeScript source that Jest leaves
untransformed by default. Add `@delacour/.*` — and for `chart`, `d3-.*` and `internmap` — to the
packages `transformIgnorePatterns` lets through, beside `jest-expo`'s own. If the path ends in
`.mjs` (`d3-shape/dist/d3-shape.mjs`), the package is let through but nothing compiles `.mjs`: add
`transform: { "^.+\\.mjs$": "babel-jest" }`. `delacour doctor` warns about both under **Jest transforms**.

### Copied tests fail to load under Vitest or Jest [#copied-tests-fail-to-load-under-vitest-or-jest]

`delacour add --tests` checks the runner straight after copying, and `delacour doctor` checks it
again under **Test runner**. Each problem comes with its fix:

| Problem | Fix |
| --- | --- |
| A package the suites import is missing | Install `@jest/globals` or `vitest`, and `@types/node` |
| The `test` script runs another runner | Set `tests.runner` and run `update --tests`, or point the script at the right runner |
| No Jest config | `"jest": { "preset": "jest-expo" }` in `package.json` |
| Vitest does not resolve `@/` | Map it in `resolve.alias` in `vitest.config.ts` |
| Vite cannot follow `expo/tsconfig.base` | `esbuild: { tsconfigRaw: "{}" }` in `vitest.config.ts` |

### A copied component does not typecheck [#a-copied-component-does-not-typecheck]

That is a registry defect rather than something wrong with your project — an import the registry
did not account for, or a package it failed to declare. Confirm it against a clean app:

```bash
bun --filter delacour run verify:expo --only <component>
```

If that run is clean, the difference is your project: check `delacour info` for where files landed,
and `tsconfig.json` for an alias that resolves somewhere unexpected.

## The full check list [#the-full-check-list]

<TypeTable
  type={{
    Expo: { type: "check", description: "An expo dependency exists; reports the SDK and React Native versions." },
    "New Architecture": { type: "check", description: "newArchEnabled is on. Reanimated 4 does not run without it." },
    Styling: { type: "check", description: "Nothing else is compiling className. NativeWind wraps Metro too, and two Tailwind transforms cannot share one config." },
    Uniwind: { type: "check", description: "uniwind and tailwindcss are installed." },
    Metro: { type: "check", description: "withUniwindConfig is present, outermost, and points at the configured CSS entry." },
    "CSS entry": {
      type: "check",
      description: "Something actually imports the Tailwind entry. Naming it in metro.config.js does not put it in the bundle.",
    },
    "Tailwind sources": { type: "check", description: "The @source globs cover every directory holding copied code, resolving symlinks." },
    "Path aliases": { type: "check", description: "experiments.tsconfigPaths is on when native-components.json uses aliases." },
    "Uniwind types": {
      type: "check",
      description:
        "uniwind-env.d.ts is present, and loadable by the app — in a shared package a copy beside the components is outside the app's tsconfig include and never loads.",
    },
    "Theme tokens": {
      type: "check",
      description:
        "theme.css is in the shape Uniwind reads, not shadcn's :root / .dark; every token it declares is aliased in its @theme inline block, and declared in both themes. A shadcn-shaped file has no dark theme at all; a token missing from the alias block has no bg-*; one missing from a theme stops Uniwind building.",
    },
    "Gesture Handler": { type: "check", description: "A GestureHandlerRootView exists at the app root." },
    "Native modules": { type: "check", description: "One copy of each native module, not two." },
    "Test runner": {
      type: "check",
      description:
        "With copied tests, the runner they were written for can run them: its packages are installed, the test script runs that runner, Jest has a config (jest-expo, or a moduleNameMapper for your alias), and Vitest maps your alias and, when tsconfig.json extends expo/tsconfig.base, sets esbuild.tsconfigRaw. A warning: only the tests break. add --tests runs it too.",
    },
    "Jest transforms": {
      type: "check",
      description:
        "On Jest with chart or bottom-sheet installed, transformIgnorePatterns lets @delacour/.* through, and d3-.* and internmap for chart. The engines ship TypeScript source; untransformed, every suite importing them fails with \"Must use import to load ES Module\". A warning: only the tests break.",
    },
    "Lock file": { type: "check", description: "native-components.lock.json exists once components are copied, so update has a base to merge from. A warning." },
    "Config version": {
      type: "check",
      description: "native-components.json is at the version this CLI writes. Behind, it predates options it was never asked about — run delacour@latest update at a terminal. A warning.",
    },
  }}
/>

## When doctor is not enough [#when-doctor-is-not-enough]

<InstallTabs commands={[{ verb: "dlx", packages: ["delacour@latest info"] }]} />

Prints the resolved config and everything that was detected — package manager, workspace root, app
root, the path aliases found in `tsconfig.json`, and the absolute directory for each namespace.
Start there when files are landing somewhere you did not expect.
