Describe the bug
I have a yarn workspace project. Running yarn workspace x storybook yields this error:
ERROR in ../node_modules/@storybook/addon-docs/dist/frameworks/react/config.js
Module not found: Error: Can't resolve '@storybook/react' in '/home/root_project_path/node_modules/@storybook/addon-docs/dist/frameworks/react'
@ ../node_modules/@storybook/addon-docs/dist/frameworks/react/config.js 3:13-40
@ ../node_modules/@storybook/addon-docs/react/config.js
@ multi ../node_modules/@storybook/core/dist/server/common/polyfills.js ../node_modules/@storybook/core/dist/server/preview/globals.js ../node_modules/@storybook/addon-docs/dist/frameworks/common/../../../react/config.js ./.storybook/config.js ../node_modules/webpack-hot-middleware/client.js?reload=true&quiet=true
I am not too familiar with how Yarn decides what packages to hoist. I have everything except @storybook/react hoisted to my root folder.
What I have under my workspace x is like so:
โโโ @babel
โย ย โโโ core
โย ย โย ย โโโ lib
โย ย โย ย โย ย โโโ config
โย ย โย ย โย ย โย ย โโโ files
โย ย โย ย โย ย โย ย โโโ helpers
โย ย โย ย โย ย โย ย โโโ validation
โย ย โย ย โย ย โโโ tools
โย ย โย ย โย ย โโโ transformation
โย ย โย ย โย ย โโโ file
โย ย โย ย โย ย โโโ util
โย ย โย ย โโโ node_modules
โย ย โโโ plugin-syntax-flow
โย ย โย ย โโโ lib
โย ย โโโ plugin-transform-flow-strip-types
โย ย โย ย โโโ lib
โย ย โโโ plugin-transform-react-constant-elements
โย ย โย ย โโโ lib
โย ย โโโ preset-flow
โย ย โโโ lib
โโโ babel-plugin-named-asset-import
โโโ debug
โย ย โโโ dist
โย ย โโโ src
โโโ ms
โโโ source-map
โย ย โโโ dist
โย ย โโโ lib
โโโ @storybook
โโโ react
โโโ bin
โโโ dist
โย ย โโโ client
โย ย โย ย โโโ preview
โย ย โโโ demo
โย ย โโโ server
โโโ node_modules
โโโ semver
โโโ bin
To Reproduce
Steps to reproduce the behavior:
xyarn workspace x storybookExpected behavior
Runs without error
System:
Environment Info:
System:
OS: Linux 5.0 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
Binaries:
Node: 12.14.0 - /usr/bin/node
Yarn: 1.21.1 - /usr/bin/yarn
npm: 6.13.4 - /usr/bin/npm
Browsers:
Chrome: 79.0.3945.88
Firefox: 71.0
npmPackages:
@storybook/react: ^5.2.8 => 5.2.8
npmGlobalPackages:
@storybook/cli: 5.2.8
I have the same issue
So I got it resolved by removing the react-is from the workspace package.json. See if it helps.
@mckn I don't believe I have react-is installed though. I currently still have to use cd x && yarn storybook for it to work. Let me see if rerunning yarn upgrade works.
EDIT: It still didn't work.
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Is nobody having the same problem with yarn package manager?
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Not hoisted here too, I'm investigating.
It seems that there is a bug with @storybook/react and workspaces. A workaround could be to disable hoisting for storybook in the root package.json of your workspace. No more errors after that for me.
More infos here: https://classic.yarnpkg.com/blog/2018/02/15/nohoist/
{
"private": true,
"workspaces": {
"packages": [
"*"
],
"nohoist": [
"@storybook",
"**/@storybook",
"**/@storybook/**"
]
}
}
@raroul there are bunch of yarn 2 related fixes that @gaetanmaisse has been working on, available in 6.0. hopefully these will make the workaround unnecessaruy.
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
Any updates on this? @raroul works, but it would be good to have a real fix :)
@delucca we fixed some issues related to Storybook usage in a monorepo a few weeks ago, can you try the latest 6.1 alpha and let us know if you still face the issue?
Most helpful comment
@raroul there are bunch of yarn 2 related fixes that @gaetanmaisse has been working on, available in 6.0. hopefully these will make the workaround unnecessaruy.