#Trouble installing storybook due to an error while installing dependencies

21 messages ยท Page 1 of 1 (latest)

fading wadi
#

I am trying to install a storybook for the first time but it keeps failing due to:
Cannot link @storybook/react-vite into before-storybook@workspace:. dependency @vitejs/plugin-react@npm:3.1.0 [2c1a5] conflicts with parent dependency @vitejs/plugin-react@npm:4.0.0 [1b0ac]\n'

I have tried using stable versions 7.0.7 to 7.0.9 but the problem still persists. Any idea what could be the problem?

median pike
#

This looks like you are trying to clone and build storybook for development. This error is being discussed here: https://github.com/storybookjs/storybook/pull/22294

If you want to start using it for your project, I would recommend just following the regular installation guidelines.

GitHub

Closes #

What I did
fix deps conflicts breaks the local react-vite sandbox : by upgrading the vite react plugin on the monorepo,
How to test

Checklist

Make sure your changes are tested (stor...

fading wadi
#

Hi, I would like to use it for the contribution. I had a look at the issue, it doesn't seem to have a good solution :/

median pike
#

Still being discussed what to do about it, it happens, I'm stuck on this too.

Any part in particular you want to contribute at? The above error shouldn't be in your way if you want to help out with cleaning up types, check out the #wg-typescript channel ๐Ÿ™‚

And let's hope we get a solution for it soon. ๐Ÿ™

fading wadi
#

ah, thank you so much! I'll shall have a read through now ๐Ÿ˜Š

dull hinge
#

@median pike thanks for following up , @fading wadi yes actually this issue is bit tricky not sure if my PR introduces some breaking changes but we will discuss this with other maintainers tomorrow.

mystic robin
#

To get past the issue for now until we find a better solution, you can make the change that @dull hinge has done in that PR on your local workspace, and just don't commit it as part of your PR. It should at least unblock you, @fading wadi.

dull hinge
mystic robin
#

Yes, the problem with the PR is not for new installations, but for existing users. People can be using Vite 3 without a react plugin, and if we make this change, their Storybook will be broken. I think we need to try to find a way to deal with it in yarn, since it's only because of yarn portals that we have this issue during development.

dull hinge
#

Yes exactly i got your point, i thought the issue is in sandbox. only but what. i don't understand

#

here is not the sandbox

#

is end user install

mystic robin
#

Do you understand why the plugin is included, and how it is used?

dull hinge
#
 const { default: react } = await import('@vitejs/plugin-react');
    plugins.push(react());

by precaution we do this in viteFinal

#

vite uses it for react same vue or others, but

#

normally user should handle this in his project

#

i don't know how react project would work without configuring vite with react plugin

mystic robin
#

Right. It's for users who do not have an app, only components. For example, I might have a project that is only the components, and then a separate project that consumes them. The component project does not have any vite config, only the separate app project. Many people structure their projects like this. So, for them, we make sure that storybook works "out of the box" without making them set up a vite config in their component project. We could think about moving away from this, and forcing them to create a vite config they don't need, just to support Storybook, but that would also be a breaking change at this point.

dull hinge
#

Yes makes sense i thought about this, but in this case he configure storybook manually, not using our cli that detects the project type

mystic robin
#

It could be done using the CLI and react would be detected, but yes they would need to use --builder=vite

mystic robin
#

Alright, I think we have a solution to the problem, @fading wadi. I've opened https://github.com/storybookjs/storybook/pull/22501, and once that's merged it should be possible to create a vite react storybook again. As a workaround in the meantime, you can add this to the resolutions section of the package.json in the sandbox:

'@vitejs/plugin-react': '^4.0.0'

and then run yarn install there, and you should be up and running.