Skip to content
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

Storybook won't start when used in a pnpm workspace #17342

Closed
robcaldecott opened this issue Jan 26, 2022 · 4 comments
Closed

Storybook won't start when used in a pnpm workspace #17342

robcaldecott opened this issue Jan 26, 2022 · 4 comments

Comments

@robcaldecott
Copy link

Describe the bug
I am experimenting with pnpm as its monorepo support is excellent. However, when using Storybook with storybook-builder-vite in a workspace it will not start and instead displays the following error:

info => Loading presets
ERR! Error: [vite-plugin-mdx] "@mdx-js/react" must be installed
ERR!     at resolveImport (/Users/caldecor/Projects/pnpm-storybook/node_modules/.pnpm/artifactory.keyloop.com+vite-plugin-mdx@3.5.10_@mdx-js+mdx@1.6.22+vite@2.7.13/node_modules/vite-plugin-mdx/dist/imports.js:29:23)
<snip>

On the face of it this looks like a dependency resolution issue as the same repo will work OK using npm8 or yarn1 workspaces.

To Reproduce
You will need pnpm installed (npm install -g pnpm).

Clone the following repo: https://github.com/robcaldecott/pnpm-storybook and then:

pnpm install
cd packages/components
pnpm storybook

System

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
  Browsers:
    Chrome: 97.0.4692.99
    Firefox: 95.0.2
    Safari: 14.1.2
  npmPackages:
    @storybook/addon-actions: ^6.4.14 => 6.4.14 
    @storybook/addon-essentials: ^6.4.14 => 6.4.14 
    @storybook/addon-links: ^6.4.14 => 6.4.14 
    @storybook/react: ^6.4.14 => 6.4.14 

Additional context
There is a proposed workaround by creating a .npmrc file in the root of the repo that looks like this:

node-linker=hoisted

However this causes pnpm some issues and seems like a last resort.

@christian-gama
Copy link

I also have this issue... Feels bad, as I am loving to use PNPM.

@stof
Copy link
Contributor

stof commented Feb 9, 2022

Based on the error message, I suspect that it might be a case of vite-plugin-mdx not declaring some optional peer dependency, or being incompatible with pnpm by expecting hoisted packages.

@stof
Copy link
Contributor

stof commented Feb 9, 2022

and storybook-builder-vite is not an official storybook package (official packages are using the @storybook namespace). So you should report it to https://github.com/eirslett/storybook-builder-vite instead

@IanVS
Copy link
Member

IanVS commented Feb 17, 2022

Closing since this was reported in storybookjs/builder-vite#237, and we'll track it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants