UNPKG

933 BJavaScriptView Raw
1#!/usr/bin/env node
2
3const majorNodeVersion = parseInt(process.versions.node, 10);
4if (majorNodeVersion < 18) {
5 console.error('To run Storybook you need to have Node.js 18 or higher');
6 process.exit(1);
7}
8
9// The Storybook CLI has a catch block for all of its commands, but if an error
10// occurs before the command even runs, for instance, if an import fails, then
11// such error will fall under the uncaughtException handler.
12// This is the earliest moment we can catch such errors.
13process.once('uncaughtException', (error) => {
14 if (error.message.includes('string-width')) {
15 console.error(
16 [
17 '🔴 Error: It looks like you are having a known issue with package hoisting.',
18 'Please check the following issue for details and solutions: https://github.com/storybookjs/storybook/issues/22431#issuecomment-1630086092\n\n',
19 ].join('\n')
20 );
21 }
22
23 throw error;
24});
25
26require('../dist/generate.js');