question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Cannot start storybook with newly generated project

See original GitHub issue

What version of vite are you using?

3.0.0

System info and storybook versions

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.16.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.11.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Safari: 15.5
  npmPackages:
    @storybook/addon-actions: ^6.5.9 => 6.5.9 
    @storybook/addon-essentials: ^6.5.9 => 6.5.9 
    @storybook/addon-interactions: ^6.5.9 => 6.5.9 
    @storybook/addon-links: ^6.5.9 => 6.5.9 
    @storybook/builder-vite: ^0.2.0 => 0.2.0 
    @storybook/testing-library: ^0.0.13 => 0.0.13 
    @storybook/vue3: ^6.5.9 => 6.5.9

Describe the Bug

ERR! Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/anh.pham/my-vue-app/.storybook/main.js from /Users/anh.pham/my-vue-app/node_modules/@storybook/core-common/dist/cjs/utils/interpret-require.js not supported.
ERR! main.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
ERR! Instead rename main.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/anh.pham/my-vue-app/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

Link to Minimal Reproducible Example

https://github.com/ahnpnl/vite-sb-ts

Participation

  • I am willing to submit a pull request for this issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
IanVScommented, Jul 25, 2022
1reaction
RodrigoNovaiscommented, Aug 24, 2022

@IanVS I’ll be doing that as soon as I can

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to troubleshoot storybook not loading stories?
Resave save the story file. It makes the component reappear in side panel, and then you can see the errors. start-storybook seems to...
Read more >
Configure Storybook
Configure your Storybook project. The main configuration file is main.js . This file controls the Storybook server's behavior, so you must restart ......
Read more >
Setting up a React + TypeScript + Storybook project - Medium
This is because you have incorrectly named the storybook folder, it should be .storybook and exist on the root of your project. We...
Read more >
How to resolve a path alias in Storybook - +return
We have solved the path alias issue with CRA projects earlier, ... solution to the problem with a few modifications to Storybook's webpack....
Read more >
How to simplify component testing with React Storybook
Getting started with Storybook; UI testing; Accessibility testing; Automated visual testing ... First, we'll bootstrap a new React project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found