nuxt-modules / storybook

Storybook integration with Nuxt.
https://storybook.nuxtjs.org
410 stars 95 forks source link

The requested module jiti@1.21.6 does not provide an export named 'default' #669

Closed hirotaka closed 4 months ago

hirotaka commented 4 months ago

I'm trying to upgrade the nuxt and storybook versions of my project. The upgrade was not successful due to the following issues:

https://github.com/nuxt-modules/storybook/issues/658

So, I've cloned this repository for further investigation in the following environments.

Node: v20.15.0 Nuxt: 3.12.1 Storybook: 8.1.9

I did the following commands to display the playground:

git clone git@github.com:nuxt-modules/storybook.git
cd storybook
pnpm install
pnpm dev:prepare
pnpm dev

Unfortunately, the following error message was displayed:

CleanShot 2024-07-02 at 21 51 25@2x

The requested module '/@fs/Users/hirotaka/Workspaces/github.com/hirotaka/nuxt-modules-storybook/node_modules/.pnpm/jiti@1.21.6/node_modules/jiti/lib/index.js' does not provide an export named 'default'
The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:

1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the [Decorators documentation](https://storybook.js.org/docs/react/writing-stories/decorators).
2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring [Webpack](https://storybook.js.org/docs/builders/webpack) or [Vite](https://storybook.js.org/docs/builders/vite) with Storybook.
3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the [Environment Variables documentation](https://storybook.js.org/docs/configure/environment-variables).

SyntaxError: The requested module '/@fs/Users/hirotaka/Workspaces/github.com/hirotaka/nuxt-modules-storybook/node_modules/.pnpm/jiti@1.21.6/node_modules/jiti/lib/index.js' does not provide an export named 'default'

Can anyone suggest any ideas for solving this problem?

tobiasdiez commented 4 months ago

This is a problem with the unbuild stubbing. You need to run pnpm build before.

hirotaka commented 4 months ago

Thanks, it worked!