You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Problem
Storybook was failing on this dev machine with:
```
SyntaxError: Identifier '__dirname' has already been declared
```
This occurred because Node.js v18.19.1 had a conflict with
esbuild-register when loading Vite code in Storybook's config.
esbuild-register was trying to declare `const __dirname` but it was
already declared in the environment.
## Solution
**Machine fix:** Upgraded Node.js from v18.19.1 to v20.19.4 using the
`n` version manager.
**Code fix:** Added Node.js version check to Makefile to prevent this
issue for others:
- Requires Node.js v20+ for all Storybook-related targets
- Provides clear error message with upgrade instructions
- Added `--no-open` flag to storybook dev to prevent xdg-open errors on
headless machines
## Verification
Storybook now starts successfully:
```
Storybook 8.6.14 for react-vite started
Local: http://localhost:6006/
```
Version check works correctly:
```bash
$ PATH="/old-node:$PATH" make storybook
Error: Node.js v20 or higher is required
Current version: v18
```
_Generated with `cmux`_
0 commit comments