tailwindlabs/tailwindcss · error · Error
No configuration file found for ${highlight(relative(start))
Error message
No configuration file found for ${highlight(relative(start))}. Please provide a path to the Tailwind CSS v3 config file via the ${highlight('--config')} option. What it means
`detectConfigPath` searches a list of default v3 config filenames (`tailwind.config.js`, `.cjs`, `.mjs`, `.ts`) walking up parent directories from `start` to `end`. If none is accessible via `fs.access`, the upgrade cannot locate the v3 config to migrate and throws, directing the user to pass `--config`.
Source
Thrown at packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts:108
'./tailwind.config.js',
'./tailwind.config.cjs',
'./tailwind.config.mjs',
'./tailwind.config.ts',
'./tailwind.config.cts',
'./tailwind.config.mts',
]
export async function detectConfigPath(start: string, end: string = start) {
for (let base of parentPaths(start, end)) {
for (let file of DEFAULT_CONFIG_FILES) {
let fullPath = path.resolve(base, file)
try {
await fs.access(fullPath)
return fullPath
} catch {}
}
}
throw new Error(
`No configuration file found for ${highlight(relative(start))}. Please provide a path to the Tailwind CSS v3 config file via the ${highlight('--config')} option.`,
)
}
// Yields all parent paths from `from` to `to` (inclusive on both ends)
function* parentPaths(from: string, to: string = from) {
let fromAbsolute = path.resolve(from)
let toAbsolute = path.resolve(to)
if (!fromAbsolute.startsWith(toAbsolute)) {
throw new Error(`The path ${from} is not a parent of ${to}`)
}
if (fromAbsolute === toAbsolute) {
yield fromAbsolute
return
}
View on GitHub (pinned to 16e94cbf7f)
Solutions
- Pass the explicit path: `npx @tailwindcss/upgrade --config ./path/to/tailwind.config.js`.
- Rename/create a config file using a default name in the project root.
- Run the upgrade from the directory containing the v3 config.
Example fix
# before npx @tailwindcss/upgrade # after npx @tailwindcss/upgrade --config ./tw.config.js
Defensive patterns
Strategy: validation
Validate before calling
import { accessSync } from 'node:fs'
import path from 'node:path'
const DEFAULTS = ['tailwind.config.js','tailwind.config.cjs','tailwind.config.mjs','tailwind.config.ts']
function findV3Config(start: string, end = start) {
for (const base of parentDirs(start, end)) {
for (const f of DEFAULTS) {
try { accessSync(path.resolve(base, f)); return path.resolve(base, f) } catch {}
}
}
throw new Error('No v3 config found; pass --config <path>')
} Prevention
- Use a default tailwind.config.* filename.
- Pass --config explicitly when using a non-default name.
- Run the upgrade from the directory containing the v3 config.
When it happens
Trigger: Running `@tailwindcss/upgrade` in a project with no `tailwind.config.*` file anywhere up the tree, or where the config has a non-default name. prepare-config.ts:108 throws after the `parentPaths`/`DEFAULT_CONFIG_FILES` loops complete without a hit.
Common situations: Projects that use a non-standard config filename (`tw.config.js`), config-in-JS without a file, or running the upgrade from the wrong directory.
Related errors
- Cannot find any CSS files that reference Tailwind CSS. Befor
- Unsupported content value: ${pattern}
- You have one or more stylesheets that are imported into a ut
- Could not find the Tailwind CSS v3 `prefix` configuration in
- Tailwind CSS is not installed
AI-assisted analysis of tailwindlabs/tailwindcss@16e94cbf7f (2026-08-12).
Data as JSON: /api/errors/2ebcb77d5d01d570.
Report an issue: GitHub.