Commit 91f9923
authored
🤖 fix: require Node.js v20+ for Storybook (#470)
## 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`_1 parent 033eccc commit 91f9923
1 file changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
49 | 71 | | |
50 | 72 | | |
51 | 73 | | |
| |||
244 | 266 | | |
245 | 267 | | |
246 | 268 | | |
247 | | - | |
| 269 | + | |
| 270 | + | |
248 | 271 | | |
249 | 272 | | |
| 273 | + | |
250 | 274 | | |
251 | 275 | | |
252 | 276 | | |
| 277 | + | |
253 | 278 | | |
254 | 279 | | |
255 | 280 | | |
| 281 | + | |
256 | 282 | | |
257 | 283 | | |
258 | 284 | | |
| |||
0 commit comments