nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.17k stars 2.31k forks source link

Conflicting errors: "Storybook 6 is no longer maintained. Please upgrade to Storybook 7." + "No Storybook packages installed" #18499

Closed lindseybradford closed 1 year ago

lindseybradford commented 1 year ago

Current Behavior

Existing monorepo. Added Lerna and ran the npx lerna add-caching command to add NX task caching.

Tried to install storybook but get conflicting errors that I should migrate to 7 but because there are no existing instances, the migration fails with "no packages found".

Expected Behavior

Run storybook setup configuration successfully

GitHub Repo

No response

Steps to Reproduce

  1. Removed existing storybook instances, removed node_modules and package-lock.json
  2. Attempt storybook install:
    • npm install -D @nx/storybook (success)
    • nx g @nx/storybook:configuration {project-name} --tsConfiguration=true --uiFramework=@storybook/react-vite (error: Storybook 6 is no longer maintained. Please upgrade to Storybook 7)
  3. Ran requested storybook 6-7 migration (despite no instances of storybook -7):
    • npx nx g @nx/storybook:migrate-7 (error: No Storybook packages installed. 🚨 Nx did not find any Storybook packages installed in your workspace. So no migration is necessary.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.14.0
   OS     : darwin-arm64
   npm    : 9.3.1

   nx (global)    : 16.5.5
   nx             : 16.6.0
   lerna          : 7.1.4
   @nx/js         : 16.6.0
   @nx/linter     : 16.6.0
   @nx/workspace  : 16.6.0
   @nx/cypress    : 16.6.0
   @nx/devkit     : 16.6.0
   @nx/storybook  : 16.6.0
   @nrwl/tao      : 16.6.0
   typescript     : 4.7.4
   ---------------------------------------
   Local workspace plugins:
     webapp_smoke_tests

Failure Logs

No response

Operating System

Additional Information

No response

mandarini commented 1 year ago

HI there @lindseybradford ! Interesting issue! Can you please share a minumum reproduction repository that I can take a quick look at?

Or at least can you share your package.json for starters?

The check we're doing for logging that error during storybook:configuration is the following:

  if (storybookMajorVersion() === 6) {
    throw new Error(pleaseUpgrade());
  }

ref: packages/storybook/src/generators/configuration/configuration.ts#L50

and the storybookMajorVersion function looks like this:

export function storybookMajorVersion(): number | undefined {
  try {
    const storybookPackageVersion = require(join(
      '@storybook/core-server',
      'package.json'
    )).version;
    return major(storybookPackageVersion);
  } catch {
    return undefined;
  }
}

ref: packages/storybook/src/utils/utilities.ts#L38

So maybe you have storybook/core-server installed?

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 11 months ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.