remix-run/react-router · error

${reactRouterConfigFile} no longer exists

Error message

${reactRouterConfigFile} no longer exists

What it means

`readConfig` was invoked with an explicit `reactRouterConfigFile` path (typically by the dev server or a watcher that resolved it earlier), and `fs.existsSync` now reports the file is gone. The config layer returns this error instead of silently falling back to an empty config, so the dev server / build aborts until the file is restored.

Source

Thrown at packages/react-router-dev/config/config.ts:459

async function resolveConfig({
  root,
  viteRunnerContext,
  reactRouterConfigFile,
  skipRoutes,
  validateConfig,
}: {
  root: string;
  viteRunnerContext: ViteRunner.Context;
  reactRouterConfigFile?: string;
  skipRoutes?: boolean;
  validateConfig?: ValidateConfigFunction;
}): Promise<ConfigResult> {
  let reactRouterUserConfig: ReactRouterConfig = {};

  if (reactRouterConfigFile) {
    try {
      if (!fs.existsSync(reactRouterConfigFile)) {
        return err(`${reactRouterConfigFile} no longer exists`);
      }

      let configModule = await viteRunnerContext.runner.import(
        reactRouterConfigFile,
      );

      if (configModule.default === undefined) {
        return err(`${reactRouterConfigFile} must provide a default export`);
      }

      if (typeof configModule.default !== "object") {
        return err(`${reactRouterConfigFile} must export a config`);
      }

      reactRouterUserConfig = configModule.default;

      if (validateConfig) {
        const error = validateConfig(reactRouterUserConfig);

View on GitHub (pinned to 6beaca3952)

Solutions

  1. Restore or recreate the config file at the exact path shown in the error message.
  2. If you intentionally renamed it (e.g. `.ts` to `.js`), update the reference and restart the dev server.
  3. Run `git status` to confirm the file wasn't removed by a branch switch or clean.
  4. Restart `react-router dev` / `react-router build` once the file exists again.
Defensive patterns

Strategy: validation

Validate before calling

import fs from "node:fs";
const CONFIG_FILE = "react-router.config.ts";
if (!fs.existsSync(CONFIG_FILE)) {
  throw new Error(`${CONFIG_FILE} is missing — restore it before running react-router`);
}

Prevention

When it happens

Trigger: The react-router config file (e.g. `react-router.config.ts`) is deleted, moved, or renamed while the dev server is running; the path was resolved on a case-insensitive filesystem and then opened on a case-sensitive one; a git branch switch or clean removed the file mid-session.

Common situations: Deleting `react-router.config.ts` to 'start fresh' while `react-router dev` is still running; renaming the file (e.g. to `.js`) without restarting; editor/git operations during a long-running dev session; monorepo tooling that regenerates config files and briefly leaves them missing.

Related errors


AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18). Data as JSON: /api/errors/ed6bb9f950ac902b. Report an issue: GitHub.