-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: string-width dependency stops storybook from executing #22431
Comments
I'm also getting this error with Yarn, changing to pnpm solved it. |
@NormySan I switched from yarn 1 to yarn 3, this also resolved it. very weird indeed. |
I've faced this issue today! Struggle to find the root cause. |
Also experiencing this error, storybook version |
Everything was working until string-width v5.0.1 was added to yarn.lock, after then I get: |
TLDR: the simplest solution here is to upgrade to Yarn 4. Yarn 1 is deprecated and I guess bugs like the below aren't going to get fixed. There is a workaround for Yarn 1 however, read on: This is an instance of this issue: isaacs/jackspeak#5, I guess technically a bug in yarn 1 -- we had thought we resolved this with #23080 but I think it was the wrong approach. It's unclear what circumstances cause the bug to be triggered, it seems to just be which package yarn in its confusion hoists to the root Context:
So a simple workaround is to fix the resolution of "resolutions": {
"jackspeak": "2.1.1"
} You may need to delete Note we don't really have any better solution because (a) Storybook can't set the resolution field for you, and (b) |
- Yarn 1 has a bug with "string-width" (Ref. storybookjs/storybook#22431 (comment)) - MSW has a bug with logging system (Ref. mswjs/msw#1640 (comment))
@estevaolucas
|
@gurkiratkn -- did you try the resolution I suggested? |
For those Mac users still using 1.22.19 you can upgrade yarn to the latest stable with: yarn set version stable
|
To be clear @jacklaurencegaray , you need to regenerate the |
@shadowspawn have you seen it work? I tried with a brand new project on yarn 1.22.22 and continued to see the original problem. As I said, I don't think the yarn 1 issue is actually fixed, although the change you pointed to does seem like a step in the right direction. I'll point out as I mentioned way back:
So it's not impossible the issue was "fixed" for you just by chance, as an aside. |
@tmeasday I saw the same hoisting problem fixed, but it was in a different project.
I did have a reproducible failure which went away when I used the new version of yarn, so I thought it was good. I commented here because this issue was linked. But maybe I was just lucky or trigger conditions changed but not fully fixed, as you say. Sorry I may have offered false hope. 😢 |
Hard to say for sure without analyzing |
This worked for me!!! Thanks |
Deleting the |
TL;DR: - install SB8 with npm and then switch back to yarn (works with yarn 1.22.22) unusual solution helped in my case:
|
fixes #20065 refs storybookjs/storybook#22431 (comment) refs isaacs/jackspeak#5 - this adds a resolution for jackspeak, which is a dependency deep inside storybook - somewhere deep in the dependency tree, we're requiring an ESM package from a CJS package, which is causing issues - this should hopefully avoid that by pinning jackspeak to a working version
fixes #20065 refs storybookjs/storybook#22431 (comment) refs isaacs/jackspeak#5 - this adds a resolution for jackspeak, which is a dependency deep inside storybook - somewhere deep in the dependency tree, we're requiring an ESM package from a CJS package, which is causing issues - this should hopefully avoid that by pinning jackspeak to a working version
fixes #20065 refs storybookjs/storybook#22431 (comment) refs isaacs/jackspeak#5 - this adds a resolution for jackspeak, which is a dependency deep inside storybook - somewhere deep in the dependency tree, we're requiring an ESM package from a CJS package, which is causing issues - this should hopefully avoid that by pinning jackspeak to a working version
@pozda thanks a lot! It works for me |
Hello all, I found a solution and would like to share how to resolve it:
It should work. Happy coding! 2024-06-03 |
This solution worked for me. Thanks! |
EDIT: Workaround described here: #22431 (comment)
Describe the bug
I am using Storybook 7 with the automatically generated vite-react setup.
When installing Storybook 7, yarn yields these dependency errors:
When running storybook, this error occurs:
Just out of curiosity, I tried changing all
require()
calls of the listed node_modules files toimport()
, and after that i got the same error that is happening in #22430 :To Reproduce
No response
System
Won't work because also npx fails with the same errors.
Additional context
I started off with storybook 7.0.8, and after uprading to 7.0.9 this happened. Now all versions have this behavior. I tried Node 16, 18 and 20, as well as clearing my yarn cache and deleting node_modules.
The text was updated successfully, but these errors were encountered: