Storybook CLI: Develop, document, and test UI components in isolation
—
Check Storybook installations for known problems and provide suggestions or fixes. The diagnostics system analyzes your Storybook setup to identify configuration issues, dependency problems, and compatibility concerns.
Comprehensive health check for Storybook installations with detailed problem reporting and fix suggestions.
storybook doctor [options]
Options:
--package-manager <npm|pnpm|yarn1|yarn2|bun> Force package manager
-c, --config-dir <dir-name> Directory of Storybook configurationUsage Examples:
# Run full diagnostic check
npx storybook doctor
# Run with specific package manager
npx storybook doctor --package-manager yarn1
# Check custom config directory
npx storybook doctor --config-dir .custom-storybook
# Run doctor with verbose output
npx storybook doctor --loglevel debugDisplay system and environment information for debugging and support.
storybook infoUsage Examples:
# Display environment information
npx storybook info
# Show detailed system info
npx storybook info --loglevel debugThe doctor command checks multiple areas:
The info command displays comprehensive system information:
Handle monorepos and multiple Storybook configurations:
# Automatically discover and check all Storybook projects
npx storybook doctor
# Check specific config directories
npx storybook doctor --config-dir packages/app/.storybookDoctor checks return structured results:
interface DiagnosticResult {
type: DiagnosticType;
status: DiagnosticStatus;
message: string;
details?: string;
suggestion?: string;
fixable?: boolean;
}
enum DiagnosticType {
CONFIGURATION = "configuration",
DEPENDENCY = "dependency",
ENVIRONMENT = "environment",
FRAMEWORK = "framework"
}
enum DiagnosticStatus {
PASS = "pass",
WARN = "warn",
ERROR = "error",
INFO = "info"
}Common issues detected by doctor:
For each identified issue, doctor provides:
Doctor seamlessly integrates with the automigration system:
# Run doctor and then apply suggested automigrations
npx storybook doctor
npx storybook automigrate
# Skip doctor when running automigrations
npx storybook automigrate --skip-doctorimport { doctor, runMultiProjectDoctor } from "@storybook/cli";
/**
* Run doctor checks programmatically
* @param options - Doctor configuration
*/
function doctor(options: DoctorOptions): Promise<void>;
/**
* Run doctor across multiple projects
* @param projects - List of project configurations
* @param options - Doctor options
*/
function runMultiProjectDoctor(
projects: CollectProjectsSuccessResult[],
options: DoctorOptions
): Promise<ProjectDoctorResults[]>;
interface DoctorOptions {
packageManager?: PackageManagerName;
configDir?: string;
}
interface ProjectDoctorResults {
configDir: string;
results: DiagnosticResult[];
summary: DiagnosticSummary;
}
interface DiagnosticSummary {
errors: number;
warnings: number;
infos: number;
total: number;
}Programmatic Examples:
import { doctor } from "@storybook/cli";
// Run doctor programmatically
await doctor({
packageManager: "npm",
configDir: ".storybook"
});Doctor provides multiple output formats:
# Generate JSON output for programmatic use
npx storybook doctor --json > doctor-results.json# Get detailed diagnostic information
npx storybook doctor --verboseDoctor helps with error recovery:
Install with Tessl CLI
npx tessl i tessl/npm-storybook--cli