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
- Restore or recreate the config file at the exact path shown in the error message.
- If you intentionally renamed it (e.g. `.ts` to `.js`), update the reference and restart the dev server.
- Run `git status` to confirm the file wasn't removed by a branch switch or clean.
- 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
- Keep react-router.config.ts under version control so branch switches and cleans never strand you without it.
- Avoid renaming the config file while the dev server is running; restart after any rename.
- Pin the exact config path you pass to custom integrations instead of re-deriving it from stale state.
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
- When using the React Router `basename` and the Vite `base` c
- React Router config loading requires Vite's __config_loader
- Could not find a root route module in the app directory as "
- Route config file not found at "${routeConfigDisplayPath}".
- The `future.v8_passThroughRequests` flag has been removed be
AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18).
Data as JSON: /api/errors/ed6bb9f950ac902b.
Report an issue: GitHub.