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]: upgrade command always throws UpgradeStorybookToSameVersionError when using pnpx #25734

Closed
JReinhold opened this issue Jan 24, 2024 · 4 comments · Fixed by #25752
Closed
Assignees
Milestone

Comments

@JReinhold
Copy link
Contributor

JReinhold commented Jan 24, 2024

Describe the bug

Running pnpm dlx storybook@next upgrade in @storybook/addon-onboarding throws UpgradeStorybookToSameVersionError, although the project uses Storybook dependencies with the version 7.1.0-alpha.38. Everything works fine when using npx storybook@next upgrade.

To Reproduce

  1. npx storybook@latest sandbox
  2. cd into sandbox
  3. pnpm install
  4. pnpx storybook@next upgrade
  5. Get error

System

No response

Additional context

Originally posted by @valentinpalkovic in #25692 (comment)

This happens because we use require.resolve('@storybook/cli/package.json') to get the actual package path, and then check the version field in the package.json. However require.resolve in pnpx will get its own package and not the one in the actual working directory.

We need to change the logic to the package manager's CLI what version is installed in CWD (eg. pnpm why @storybook/cli), and then parse that output to determine the current version.

yarn dlx with Yarn 1 works, but 2+ has a similar issue where it can't detect the existing version so it just assumes v0.0.0

@IanVS
Copy link
Member

IanVS commented Jan 24, 2024

Hah, I just noticed this as well when using pnpm dlx sb@latest upgrade in my project and came to see if there was already an issue about it. Thanks for filing it!

I also saw that npx is a bit wonky too, because it tells me:

 Upgrading Storybook from version 0.0.0 to version 7.6.10.

When my current version is really 7.6.0-alpha.6

@JReinhold
Copy link
Contributor Author

@IanVS could you try with npx [email protected] upgrade from #25752 ? I've tested it with all the different executors and it works for me, but I haven't run into the issue using npx like you have, so you might have another setup that I'd like to see work too.

@github-project-automation github-project-automation bot moved this from Waiting to Done in Core Team Projects Jan 29, 2024
@IanVS
Copy link
Member

IanVS commented Jan 29, 2024

This is what I see with that canary:

╭─────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                     │
│   Upgrading Storybook from version 7.6.0 to version 0.0.0-pr-25752-sha-424630b7..   │
│   This is a pre-release version.                                                    │
│                                                                                     │
╰─────────────────────────────────────────────────────────────────────────────────────╯

@gluecksmensch
Copy link

same for me

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

Successfully merging a pull request may close this issue.

3 participants