Not fully compatible with Yarn PnP
See original GitHub issuehttps://github.com/remigailard80/Storybook-Vite
Env : Node 14.17 MacBook Air (M1, 2020) Big Sur 11.3.1
I tried to start storybook project with vite with this flow.
yarn create vite
cd vite-project
npx sb@next init --builder storybook-builder-vite
yarn storybook
and saw this error.
Error: storybook-builder-vite tried to access @storybook/core-common, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
After saw this error, I tried install @storybook/core-common, @storybook/client-api, @storybook/client-logger(?). Eventually, it succeeded in running the development server, but it was caught in infinite loading.
But when i use nodeLinker: node-modules,
It works fine.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:45 (19 by maintainers)
Top Results From Across the Web
Plug'n'Play | Yarn - Package Manager
An overview of Plug'n'Play, a powerful and innovative installation strategy for Node.
Read more >What is Yarn PNP and Should You Use It? - Atomic Spin
The first thing to consider is that not all libraries are compatible with the illusion Yarn is presenting with PNP.
Read more >Yarn 2, Yarn 3, PNP, and our migration journey - Jakub Zitny
At our second Productboard Frontend Meetup, the Software Engineer from Deepnote - Jakub Zitny, talked about Yarn 2, Yarn 3, PNP, and their ......
Read more >Running scripts with Yarn 2's PnP - Stack Overflow
Just running yarn ts-node [...] (or yarn run ts-node [...] ) works fine.
Read more >Migrating our Monorepo to Yarn 2 | DoltHub Blog
When it upgrades a dependency it either does not come with yarn.lock changes or converts the yarn.lock file to Yarn Classic, which breaks ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Still same bug using 0.1.9,
I was able to get this working, but it’s not pretty. First of all, it seems necessary to set
pnpMode: loose
in.yarnrc.yml
.Then, because yarn pnp prevents us from relying on the correct packages being installed in node_modules from other storybook packages, it’s necessary to install many of the internal storybook packages into your project as well. This is what I ended up with after hitting a “not found” error, adding the package, running
yarn install
and repeating the process:When you do this, it might be best to remove the
^
from the versions, because it’s very important that the core storybook packages all end up resolving to the exact same version.If anyone else here has a good understanding of yarn pnp and how to make things work more cleanly, I’d love to hear from you!