facebook/docusaurus · error · Error

No config file found in site dir code=${relativeSiteDir}.\nE

Error message

No config file found in site dir code=${relativeSiteDir}.\nExpected one of:${candidates.map(logger.code)}\nYou can provide a custom config path with the code=${'--config'} option.

What it means

Thrown by `findConfig(siteDir)` when none of the supported config file names (`docusaurus.config.{ts,mts,cts,js,mjs,cjs}`) exist in the site directory. Docusaurus auto-discovers a config by extension; if none is present and no `--config` was supplied, it cannot load site config.

Source

Thrown at packages/docusaurus/src/server/config.ts:30

  DEFAULT_CONFIG_FILE_NAME,
  findAsyncSequential,
  loadFreshModule,
} from '@docusaurus/utils';
import {validateConfig} from './configValidation';
import type {LoadContext} from '@docusaurus/types';

async function findConfig(siteDir: string) {
  // We could support .mjs, .ts, etc. in the future
  const candidates = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'].map(
    (ext) => DEFAULT_CONFIG_FILE_NAME + ext,
  );
  const configPath = await findAsyncSequential(
    candidates.map((file) => path.join(siteDir, file)),
    fs.pathExists,
  );
  if (!configPath) {
    const relativeSiteDir = path.relative(process.cwd(), siteDir);
    throw new Error(logger.interpolate`No config file found in site dir code=${relativeSiteDir}.
Expected one of:${candidates.map(logger.code)}
You can provide a custom config path with the code=${'--config'} option.
    `);
  }
  return configPath;
}

export async function loadSiteConfig({
  siteDir,
  customConfigFilePath,
}: {
  siteDir: string;
  customConfigFilePath?: string;
}): Promise<Pick<LoadContext, 'siteConfig' | 'siteConfigPath'>> {
  const siteConfigPath = customConfigFilePath
    ? path.resolve(siteDir, customConfigFilePath)
    : await findConfig(siteDir);

View on GitHub (pinned to 3f483e80e3)

Solutions

  1. Change into the directory that contains your `docusaurus.config.{js,ts,...}` and re-run the command.
  2. Create a config file using one of the supported extensions if you do not have one yet (`create-docusaurus` can scaffold it).
  3. Point at the config explicitly: `docusaurus start --config path/to/docusaurus.config.js`.
  4. Restore the config file if it was accidentally deleted/renamed.

Example fix

# before: wrong directory
docusaurus start  # throws from repo root
# after
cd website
docusaurus start
# or
docusaurus start --config website/docusaurus.config.js
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'fs-extra';
const exts = ['.ts','.mts','.cts','.js','.mjs','.cjs'];
const found = await findAsyncSequential(exts.map(e => path.join(siteDir, 'docusaurus.config'+e)), fs.pathExists);
if (!found) throw new Error('No docusaurus.config.* in siteDir');

Prevention

When it happens

Trigger: Running any Docusaurus CLI command from a directory that contains no `docusaurus.config.*` file (e.g. wrong cwd, fresh repo before creating config, config renamed to something non-standard).

Common situations: Running `docusaurus start` from the monorepo root instead of `website/`; renamed config to `config.js`; brand-new project where the config has not been created yet; cloned a repo whose config lives in a subfolder.

Related errors


AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12). Data as JSON: /api/errors/90453f8cd8f0b2c2. Report an issue: GitHub.