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

[Bug]: Storybook 8 injecting packageManager on NPM #30751

Open
mosesoak opened this issue Mar 4, 2025 · 1 comment
Open

[Bug]: Storybook 8 injecting packageManager on NPM #30751

mosesoak opened this issue Mar 4, 2025 · 1 comment

Comments

@mosesoak
Copy link

mosesoak commented Mar 4, 2025

Describe the bug

Partial duplicate of #29146 – that issue relates to PNPM

Storybook alters the project's package.json adding a packageManager entry that is

A) Undesired – how to disable this invasive behavior?

B) Incorrect – it sets it to Yarn even though the project uses NPM, not Yarn

Image

Reproduction link

None

Reproduction steps

No response

System

Storybook Environment Info:

  System:
    OS: macOS 15.3
    CPU: (16) arm64 Apple
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.0/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm <----- active
  Browsers:
    Chrome: 133.0.6943.142
    Safari: 18.3
  npmPackages:
    @storybook/addon-essentials: ^8.5.3 => 8.5.5
    @storybook/addon-interactions: ^8.5.3 => 8.5.5
    @storybook/addon-links: ^8.5.3 => 8.5.4
    @storybook/addon-styling-webpack: ^1.0.1 => 1.0.1
    @storybook/addon-themes: ^8.5.3 => 8.5.5
    @storybook/blocks: ^8.5.3 => 8.5.5
    @storybook/preview-api: ^8.5.3 => 8.5.3
    @storybook/react: ^8.5.3 => 8.5.3
    @storybook/react-webpack5: ^8.5.3 => 8.5.3
    chromatic: ^6.19.9 => 6.19.9
    storybook: ^8.5.3 => 8.5.5
    storybook-addon-react-router-v6: ^2.0.15 => 2.0.15
    storybook-react-i18next: ^3.2.1 => 3.2.1

Additional context

No response

Copy link
Contributor

greptile-apps bot commented Mar 4, 2025

** Disclaimer** This information might be inaccurate, due to it being generated automatically
This behavior is controlled in code/lib/cli/src/detect.ts. To prevent Storybook from adding the packageManager field: 1. Add STORYBOOK_DISABLE_PACKAGE_MANAGER_DETECTION=true to your environment variables The incorrect detection likely occurs in the getPackageManager() function in detect.ts which checks for lockfiles in this order: - yarn.lock - pnpm-lock.yaml - package-lock.json This means if both yarn.lock and package-lock.json exist, yarn will be incorrectly detected. You can either: 1. Delete any yarn.lock file if not using yarn 2. Set the environment variable above to disable detection entirely

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Edit Issue Bot Settings · Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Discussion
Development

No branches or pull requests

2 participants