index.js 966 B

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