shadcn-ui/ui · error · Error
File not found: ${migratePath}
Error message
File not found: ${migratePath} What it means
When migrateCn receives a non-glob `path`, resolveMigrationFiles resolves it against cwd and stats it with fs.stat. If the path does not exist on disk (stat resolves to null), the CLI throws `File not found: ${migratePath}` instead of proceeding. It applies to both file and directory inputs.
Source
Thrown at packages/shadcn/src/migrations/cn/files.ts:40
]
export async function resolveMigrationFiles(cwd: string, migratePath?: string) {
if (!migratePath) {
return findSourceFiles(cwd)
}
if (migratePath.includes("*")) {
const files = await findSourceFiles(cwd, migratePath)
if (!files.length) {
throw new Error(`No files found matching: ${migratePath}`)
}
return files
}
const resolvedPath = path.resolve(cwd, migratePath)
const stat = await fs.stat(resolvedPath).catch(() => null)
if (!stat) {
throw new Error(`File not found: ${migratePath}`)
}
if (stat.isFile()) {
return [resolvedPath]
}
if (stat.isDirectory()) {
const files = await findSourceFiles(resolvedPath)
if (!files.length) {
throw new Error(`No files found matching: ${migratePath}`)
}
return files
}
throw new Error(`Unsupported path type: ${migratePath}`)
}
function findSourceFiles(cwd: string, pattern = SOURCE_PATTERN) {View on GitHub (pinned to 5c7072da67)
Solutions
- Correct the path passed via --path to an existing file or directory relative to the project root.
- Run `ls <path>` from the same cwd the CLI uses to confirm the path exists.
- Check case sensitivity of the path on Linux/CI environments.
- Omit --path entirely to migrate all source files discovered from the project root.
Example fix
// before
await migrateCn({ cwd: process.cwd(), path: 'src/lib/utills.ts' })
// after
await migrateCn({ cwd: process.cwd(), path: 'src/lib/utils.ts' }) Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs'
import { resolve } from 'path'
const p = resolve(process.cwd(), 'src/lib/utils.ts')
if (!existsSync(p)) throw new Error(`Path does not exist: ${p}`)
await migrateCn({ cwd: process.cwd(), path: 'src/lib/utils.ts' }) Prevention
- Verify the path exists from the same cwd the CLI runs in.
- Watch out for case-sensitive filesystems in CI/Linux.
- Omit --path when you want whole-project discovery.
When it happens
Trigger: migrateCn({ cwd, path: 'src/lib/utils.ts' }) where the file was renamed/deleted, or path 'src/lib' where the directory does not exist; also a mistyped relative path or a path outside the cwd that was never created.
Common situations: Typos in the path (`src/lib/utills.ts`), moving utils during a refactor, running from the wrong working directory, casing mismatches on case-sensitive filesystems (Linux), passing an absolute path that belongs to another machine/container.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Failed to read config at ${options.cwd}.
- Unsupported path type: ${migratePath}
- No `package.json` file found. Ensure you are at the root of
- Missing value for --only. Use one or more of: ${APPLY_ONLY_V
- Invalid value for --only: ${value}. Use one or more of: ${AP
AI-assisted analysis of shadcn-ui/ui@5c7072da67 (2026-09-07).
Data as JSON: /api/errors/c25c3a649f0bb15e.
Report an issue: GitHub.