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]: "No package matched your request" from storybook upgrade in monorepo #26421

Closed
joshkel opened this issue Mar 11, 2024 · 5 comments · Fixed by #26585
Closed

[Bug]: "No package matched your request" from storybook upgrade in monorepo #26421

joshkel opened this issue Mar 11, 2024 · 5 comments · Fixed by #26585

Comments

@joshkel
Copy link

joshkel commented Mar 11, 2024

Describe the bug

I tried upgrading Storybook to version 8, following the migration guide, and got errors similar to the following:

Error: Command failed with exit code 1: yarn info --name-only --recursive @storybook/addon-a11y @storybook/addon-actions @storybook/addon-backgrounds @storybook/addon-controls @storybook/addon-docs @storybook/addon-essentials @storybook/addon-highlight @storybook/addon-interactions @storybook/addon-jest @storybook/addon-links @storybook/addon-mdx-gfm @storybook/addon-measure @storybook/addon-onboarding @storybook/addon-outline @storybook/addon-storysource @storybook/addon-themes @storybook/addon-toolbars @storybook/addon-viewport @storybook/angular @storybook/blocks @storybook/builder-manager @storybook/builder-vite @storybook/builder-webpack5 @storybook/channels @storybook/cli @storybook/client-logger @storybook/codemod @storybook/components @storybook/core-common @storybook/core-events @storybook/core-server @storybook/core-webpack @storybook/csf-plugin @storybook/csf-tools @storybook/docs-tools @storybook/ember @storybook/html @storybook/html-vite @storybook/html-webpack5 @storybook/instrumenter @storybook/manager @storybook/manager-api @storybook/nextjs @storybook/node-logger @storybook/preact @storybook/preact-vite @storybook/preact-webpack5 @storybook/preset-create-react-app @storybook/preset-html-webpack @storybook/preset-preact-webpack @storybook/preset-react-webpack @storybook/preset-server-webpack @storybook/preset-svelte-webpack @storybook/preset-vue3-webpack @storybook/preview @storybook/preview-api @storybook/react @storybook/react-dom-shim @storybook/react-vite @storybook/react-webpack5 @storybook/router @storybook/server @storybook/server-webpack5 @storybook/source-loader @storybook/svelte @storybook/svelte-vite @storybook/svelte-webpack5 @storybook/sveltekit @storybook/telemetry @storybook/test @storybook/theming @storybook/types @storybook/vue3 @storybook/vue3-vite @storybook/vue3-webpack5 @storybook/web-components @storybook/web-components-vite @storybook/web-components-webpack5 sb storybook
Usage Error: No package matched your request

$ yarn info [-A,--all] [-R,--recursive] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--name-only] [--virtuals] [--json] ...
    at makeError (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Yarn2Proxy.executeCommand (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/core-common/dist/index.js:35:1755)
    at async Yarn2Proxy.findInstallations (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/core-common/dist/index.js:39:4611)
    at async getInstalledStorybookVersion (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/cli/dist/generate.js:604:599)
    at async doUpgrade (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/cli/dist/generate.js:605:1481)
    at async withTelemetry (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/core-server/dist/index.js:28:3579)
    at async upgrade (/Users/josh/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/cli/dist/generate.js:612:2094)

The problem appears to be caused by our monorepo setup: only one of the projects in our monorepo has a React UI, so the various Storybook packages are only listed as dependencies of one of the monorepo components, not of the top-level package.json.

I believe that changing yarn info --name-only --recursive to yarn info --name-only --recursive --all should address this; see docs.

To Reproduce

No response

System

Storybook Environment Info:

  System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 4.1.1 - /opt/homebrew/bin/yarn <----- active
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.15.4 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 122.0.6261.112
    Edge: 122.0.2365.80
    Safari: 17.4

Additional context

No response

@yannbf
Copy link
Member

yannbf commented Mar 19, 2024

Hey @joshkel would you mind explaining a bit better on how to set up a reproduction for your issue? That would be highly valuable for us. If you have or can set up a repro you can share, that would be even more appreciated!

@robinelvin
Copy link

I have the same issue. My audit failed with the following:

yarn npm audit --all
└─ @storybook/testing-library
   ├─ ID: @storybook/testing-library (deprecation)
   ├─ Issue: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.
   ├─ Severity: moderate
   ├─ Vulnerable Versions: 0.2.2
   │
   ├─ Tree Versions
   │  └─ 0.2.2
   │
   └─ Dependents
      └─ @elixirsoftware/core-ui@workspace:packages/core-ui

So I have tried to perform the upgrade and I get this:

yarn dlx storybook@latest upgrade
➤ YN0000: · Yarn 4.1.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + storybook@npm:8.1.1, @ampproject/remapping@npm:2.3.0, @aw-web-design/x-default-browser@npm:1.4.126, @babel/code-frame@npm:7.24.2, and 620 more.
➤ YN0000: └ Completed in 6s 521ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 83 packages were added to the project (+ 9.64 MiB).
➤ YN0000: └ Completed in 2s 605ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ esbuild@npm:0.20.2 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 318ms
➤ YN0000: · Done with warnings in 10s 539ms

Error: Command failed with exit code 1: yarn info --name-only --recursive @storybook/addon-a11y @storybook/addon-actions @storybook/addon-backgrounds @storybook/addon-controls @storybook/addon-docs @storybook/addon-essentials @storybook/addon-highlight @storybook/addon-interactions @storybook/addon-jest @storybook/addon-links @storybook/addon-mdx-gfm @storybook/addon-measure @storybook/addon-onboarding @storybook/addon-outline @storybook/addon-storysource @storybook/addon-themes @storybook/addon-toolbars @storybook/addon-viewport @storybook/angular @storybook/blocks @storybook/builder-manager @storybook/builder-vite @storybook/builder-webpack5 @storybook/channels @storybook/cli @storybook/client-logger @storybook/codemod @storybook/components @storybook/core-common @storybook/core-events @storybook/core-server @storybook/core-webpack @storybook/csf-plugin @storybook/csf-tools @storybook/docs-tools @storybook/ember @storybook/html @storybook/html-vite @storybook/html-webpack5 @storybook/instrumenter @storybook/manager @storybook/manager-api @storybook/nextjs @storybook/node-logger @storybook/preact @storybook/preact-vite @storybook/preact-webpack5 @storybook/preset-create-react-app @storybook/preset-html-webpack @storybook/preset-preact-webpack @storybook/preset-react-webpack @storybook/preset-server-webpack @storybook/preset-svelte-webpack @storybook/preset-vue3-webpack @storybook/preview @storybook/preview-api @storybook/react @storybook/react-dom-shim @storybook/react-vite @storybook/react-webpack5 @storybook/router @storybook/server @storybook/server-webpack5 @storybook/source-loader @storybook/svelte @storybook/svelte-vite @storybook/svelte-webpack5 @storybook/sveltekit @storybook/telemetry @storybook/test @storybook/theming @storybook/types @storybook/vue3 @storybook/vue3-vite @storybook/vue3-webpack5 @storybook/web-components @storybook/web-components-vite @storybook/web-components-webpack5 sb storybook
Usage Error: No package matched your request

$ yarn info [-A,--all] [-R,--recursive] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--name-only] [--virtuals] [--json] ...
    at makeError (/Users/rob/.yarn/berry/cache/execa-npm-5.1.1-191347acf5-10.zip/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/rob/.yarn/berry/cache/execa-npm-5.1.1-191347acf5-10.zip/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Yarn2Proxy.executeCommand (/private/var/folders/p6/s92jvcdj1m37h71ygtl8cs_r0000gn/T/xfs-dfbf8ae5/dlx-32513/.yarn/__virtual__/@storybook-core-common-virtual-ae658d8b6a/9/Users/rob/.yarn/berry/cache/@storybook-core-common-npm-8.1.1-83aee535dc-10.zip/node_modules/@storybook/core-common/dist/index.js:35:1948)
    at async Yarn2Proxy.findInstallations (/private/var/folders/p6/s92jvcdj1m37h71ygtl8cs_r0000gn/T/xfs-dfbf8ae5/dlx-32513/.yarn/__virtual__/@storybook-core-common-virtual-ae658d8b6a/9/Users/rob/.yarn/berry/cache/@storybook-core-common-npm-8.1.1-83aee535dc-10.zip/node_modules/@storybook/core-common/dist/index.js:39:4938)
    at async getInstalledStorybookVersion (/Users/rob/.yarn/berry/cache/@storybook-cli-npm-8.1.1-cca0b1bd82-10.zip/node_modules/@storybook/cli/dist/generate.js:642:599)
    at async doUpgrade (/Users/rob/.yarn/berry/cache/@storybook-cli-npm-8.1.1-cca0b1bd82-10.zip/node_modules/@storybook/cli/dist/generate.js:643:1481)
    at async withTelemetry (/Users/rob/.yarn/berry/cache/@storybook-core-server-npm-8.1.1-c8e68e5d7d-10.zip/node_modules/@storybook/core-server/dist/index.js:28:3599)
    at async upgrade (/Users/rob/.yarn/berry/cache/@storybook-cli-npm-8.1.1-cca0b1bd82-10.zip/node_modules/@storybook/cli/dist/generate.js:650:2097)

attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

@yannbf
Copy link
Member

yannbf commented May 20, 2024

@robinelvin thanks for reporting! Would you mind giving a minimal reproduction? Are you maybe in a monorepo and have Storybook set up in a specific directory, but ran the upgrade command in the root? Can you give as much detail as possible into how this happened?

@robinelvin
Copy link

@yannbf Thanks for the quick response. I do indeed have a monorepo and I did run the command in the root. I have since run the command in the relevant package directory and have successfully performed the upgrade.

So this was my mistake but there are no instructions that I can see at Storybook - Automatic Upgrade that mention monorepo steps. Also, the error that is thrown isn't informative. If it were possible to detect a monorepo setup by perhaps finding the workspaces entry in package.json and stopping there that might help.

I think my confusion came from the fact I always use yarn workspace <workspace name> <command> to run in the right context but the yarn dlx command only works at the root level. Probably more of an issue for the Yarn devs.

Thanks

@appdeveloper-gf
Copy link

appdeveloper-gf commented Jun 12, 2024

I'm getting the same error :( Is there anyone who can help me?

➤ YN0000: · Yarn 4.2.2
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + storybook@npm:8.1.6, @ampproject/remapping@npm:2.3.0, @aw-web-design/x-default-browser@npm:1.4.126, @babel/code-frame@npm:7.24.7, and 606 more.
➤ YN0000: └ Completed in 2s 77ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 588 packages were added to the project (+ 88.29 MiB).
➤ YN0000: └ Completed in 0s 341ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ esbuild@npm:0.20.2 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 0s 783ms
➤ YN0000: · Done with warnings in 3s 262ms


(node:14031) [DEP0040] DeprecationWarning: The 'punycode' module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Command failed with exit code 1: yarn info --name-only --recursive @storybook/addon-a11y @storybook/addon-actions @storybook/addon-backgrounds @storybook/addon-controls @storybook/addon-docs @storybook/addon-essentials @storybook/addon-highlight @storybook/addon-interactions @storybook/addon-jest @storybook/addon-links @storybook/addon-mdx-gfm @storybook/addon-measure @storybook/addon-onboarding @storybook/addon-outline @storybook/addon-storysource @storybook/addon-themes @storybook/addon-toolbars @storybook/addon-viewport @storybook/angular @storybook/blocks @storybook/builder-manager @storybook/builder-vite @storybook/builder-webpack5 @storybook/channels @storybook/cli @storybook/client-logger @storybook/codemod @storybook/components @storybook/core-common @storybook/core-events @storybook/core-server @storybook/core-webpack @storybook/csf-plugin @storybook/csf-tools @storybook/docs-tools @storybook/ember @storybook/html @storybook/html-vite @storybook/html-webpack5 @storybook/instrumenter @storybook/manager @storybook/manager-api @storybook/nextjs @storybook/node-logger @storybook/preact @storybook/preact-vite @storybook/preact-webpack5 @storybook/preset-create-react-app @storybook/preset-html-webpack @storybook/preset-preact-webpack @storybook/preset-react-webpack @storybook/preset-server-webpack @storybook/preset-svelte-webpack @storybook/preset-vue3-webpack @storybook/preview @storybook/preview-api @storybook/react @storybook/react-dom-shim @storybook/react-vite @storybook/react-webpack5 @storybook/router @storybook/server @storybook/server-webpack5 @storybook/source-loader @storybook/svelte @storybook/svelte-vite @storybook/svelte-webpack5 @storybook/sveltekit @storybook/telemetry @storybook/test @storybook/theming @storybook/types @storybook/vue3 @storybook/vue3-vite @storybook/vue3-webpack5 @storybook/web-components @storybook/web-components-vite @storybook/web-components-webpack5 sb storybook
Internal Error: @gfforsikring/ui-components@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
    at Xx.getCandidates (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:205:8149)
    at Pd.getCandidates (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:141:1311)
    at /Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:210:8409
    at Ky (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:140:53916)
    at Fe (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:210:8389)
    at async Promise.allSettled (index 0)
    at async _c (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:140:53244)
    at async /Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:210:9140
    at async Qi.startProgressPromise (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:140:137284)
    at async St.resolveEverything (/Users/michaelchang/.cache/node/corepack/v1/yarn/4.2.2/yarn.js:210:7138)
    at makeError (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/cache/execa-npm-5.1.1-191347acf5-c8e615235e.zip/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/cache/execa-npm-5.1.1-191347acf5-c8e615235e.zip/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Yarn2Proxy.executeCommand (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/__virtual__/@storybook-core-common-virtual-38ac2585c6/0/cache/@storybook-core-common-npm-8.1.6-036baff1cf-4179b7de1d.zip/node_modules/@storybook/core-common/dist/index.js:35:1948)
    at async Yarn2Proxy.findInstallations (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/__virtual__/@storybook-core-common-virtual-38ac2585c6/0/cache/@storybook-core-common-npm-8.1.6-036baff1cf-4179b7de1d.zip/node_modules/@storybook/core-common/dist/index.js:39:4938)
    at async getInstalledStorybookVersion (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/cache/@storybook-cli-npm-8.1.6-6e83b95ca5-baab95035c.zip/node_modules/@storybook/cli/dist/generate.js:642:599)
    at async doUpgrade (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/cache/@storybook-cli-npm-8.1.6-6e83b95ca5-baab95035c.zip/node_modules/@storybook/cli/dist/generate.js:643:1481)
    at async withTelemetry (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/cache/@storybook-core-server-npm-8.1.6-13e343dafc-c4ae246aa4.zip/node_modules/@storybook/core-server/dist/index.js:40:3599)
    at async upgrade (/private/var/folders/q0/yl413gss4qxd7d3mbzlt27nh0000gn/T/xfs-70fa4b53/dlx-14023/.yarn/cache/@storybook-cli-npm-8.1.6-6e83b95ca5-baab95035c.zip/node_modules/@storybook/cli/dist/generate.js:650:2097)

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

Successfully merging a pull request may close this issue.

7 participants