Closed liamlows closed 1 year ago
This does not seem to be limited to yarn
- facing the same issue using npm
after upgrading to next13.
I tried resolving it by moving to storybook v7 (previously on v6.5.14), but the issue persisted. Any workaround for now?
@liamlows does this reproduce in other package managers or is it just a Yarn PNP thing?
@liamlows does this reproduce in other package managers or is it just a Yarn PNP thing?
I have not tested with npm myself but @mohitb35 said in his comment he had the same issue when using Next13 and npm. Next13 ships default with the swc compiler (no babel) which could be related?
The way we have Yarn 3 setup prevents any packages that might try to load other packages on the system that are not installed by the user (peer dependencies). That is what is happening in this case. If babel is a peer dependency then I can install it but it's not listed in the readme anywhere that it is needed.
We were facing the same issue, but when writing up a reply sharing our configuration I noticed that we were using css-loader
5.0.1. Updating this to the latest version (6.8.1) resolved this error for us.
On to the next broken part of our config, hope this helps someone else who is facing this same issue
We were facing the same issue, but when writing up a reply sharing our configuration I noticed that we were using
css-loader
5.0.1. Updating this to the latest version (6.8.1) resolved this error for us.On to the next broken part of our config, hope this helps someone else who is facing this same issue
@zoeyfrisart This may seem a stupid question, but where did you update the config? Did you just install the latest css-loader
version via your package manager? I don't have css-loader
as a direct dependency in my project, it only seems to be a sub dependency of @storybook/builder-webpack5
and /@storybook/nextjs
and it's already at 6.8.1 there.
Manually installing css-loader
v6.8.1 did the trick for me. The version I had in @storybook/builder-webpack5
was v6.7.1 (SB v7.0.26).
This appears to be fixed for me in Storybook 7.1.0
@liamlows @mohitb35 does upgrading to Storybook v7.1 with npx storybook@latest upgrade
fix the issue for you?
Hi there! Thank you for opening this issue, but it has been marked as stale
because we need more information to move forward. Could you please provide us with the requested reproduction or additional information that could help us better understand the problem? We'd love to resolve this issue, but we can't do it without your help!
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding.
@JReinhold Sorry for the late response on this, I switched projects for a bit and took vacation so I'm just now getting back into the swing of things.
With regards to using the latest version of storybook and trying again, I am still getting errors on first boot after installing a fresh repo with Yarn 3.6.3, Next 13.4.19, and storybook 7.4.0. I used the same reproduction steps as above except this time I did not use the new app directory feature (part of next 13) as this feature has been causing a great deal of issues with some of our projects, we have opted to delay its adoption.
The first error i get is regarding webpack:
Failed to load preset: "[USER PATH]/storybook-test/.yarn/__virtual__/@storybook-nextjs-virtual-9594461007/0/cache/@storybook-nextjs-npm-7.4.0-c8e1975ea7-38160456f0.zip/node_modules/@storybook/nextjs/preset"
Error: @storybook/nextjs tried to access webpack (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.
After installing webpack yarn add --dev webpack
, I am able to start up storybook without issue. Ideally this would be listed as a peer dependency or noted in the instructions?
I also noticed looking back on the install instructions that one should use npx storybook@latest init
when adding to an existing project. When I have tried installing storybook I have used yarn dlx storybook init
so maybe the dlx command is failing to run properly? I assumed using the dlx command is ideal in this situation since it is kind of a yarn alias to npx but im not 100% on that.
Regardless with the updated storybook I only got the one error regarding webpack, other than that, it seems to work.
6.8.1
Thank you 🥇
Manually installing
css-loader
v6.8.1 did the trick for me. The version I had in@storybook/builder-webpack5
was v6.7.1 (SB v7.0.26).
This worked for me! Thanks
Describe the bug
Howdy!
First I'll go ahead and say that we are using Yarn 3 with PNP and zero installs and we are also using Next.JS 13 with the SWC compiler.
When adding Storybook using the recommended installation instructions under "Getting Started" and running
yarn dlx sb init
, the installer fails to install all necessary dependencies and (once resolved) on initial startup fails with a CSS loader issue.I assume that this is not the intended functionality as all I have done is install storybook. Haven't created anything yet.
Here are the errors I saw in order:
After installing those three as dev dependencies that there were no more package errors, but instead an error with default storybook components included in the initial installation (at least I assume):
To Reproduce
I attempted to try and get Stackbiltz or Code Sandbox set up with Yarn 3 but it kept failing. All you need to do to reproduce is run the following (I'm using node v18.16.0 and yarn v3.6.0).
corepack enable
andcorepack prepare yarn@stable --activate
yarn create next-app
, i answery
to all exceptsrc
directory and import alias questions.yarn set version berry
. After this we need to enable pnp so addnodeLinker: pnp
under the yarnPath line in your.yarnrc.yml
. Then run ayarn --version
to check the version and ayarn install
to migrate any/all packages over.yarn dlx storybook init
yarn storybook
You will see that the app will startup with several dependency errors and if you add all the dependencies it errors on, it will throw the css-loader error. I assume that this is all not intentional and a bug with storybook and Yarn 3 PNP
System
Additional context
No response