Skip to content

Cli: Use npm for registry URL in PNPMProxy to avoid workspace errors#33571

Merged
valentinpalkovic merged 2 commits intostorybookjs:nextfrom
ia319:bug/33508-use-npm-for-workspace-registry
Jan 29, 2026
Merged

Cli: Use npm for registry URL in PNPMProxy to avoid workspace errors#33571
valentinpalkovic merged 2 commits intostorybookjs:nextfrom
ia319:bug/33508-use-npm-for-workspace-registry

Conversation

@ia319
Copy link
Copy Markdown
Member

@ia319 ia319 commented Jan 17, 2026

Closes #33508

What I did

Since pnpm config get registry falls back to using npm in pnpm v10.7.1+. (pnpm/pnpm#9346)

, and when the project is inside a workspace subpackage, this can cause errors (npm/cli#6099 (comment)).

I referred to BUNProxy.ts and avoided the workspace subpackage error by using the npm config get registry command with the -ws=false -iwr flags.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

pnpm > 10.7.0

  1. mkdir test && cd test
  2. pnpm init
  3. echo '{"name": "test", "private": true, "workspaces": ["apps/*"]}' > package.json
  4. echo "packages: ['apps/*']" > pnpm-workspace.yaml
  5. mkdir apps && cd apps
  6. pnpm create vite && cd vite-project
  7. node ~/path/to/storybook/code/lib/create-storybook/dist/bin/index.js

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Bug Fixes
    • Updated registry URL retrieval mechanism to work correctly in workspace environments by adjusting how registry configuration is obtained.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

The getRegistryURL method in PNPMProxy has been modified to use npm CLI instead of pnpm to fetch the registry URL, adding explicit configuration flags and error handling for undefined string results.

Changes

Cohort / File(s) Summary
Registry URL Fetching
code/core/src/common/js-package-manager/PNPMProxy.ts
Changed getRegistryURL implementation from pnpm config get registry to npm config get registry with explicit cwd parameter and additional flags (-ws=false, -iwr). Added logic to return undefined when result is the string "undefined", along with explanatory comments about pnpm workspace mode limitations and npm CLI constraints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot bot commented Jan 17, 2026

Package Benchmarks

Commit: f251df3, ran on 29 January 2026 at 12:31:06 UTC

No significant changes detected, all good. 👏

@ia319 ia319 changed the title Core: Use npm for registry URL in PNPMProxy to avoid workspace errors Cli: Use npm for registry URL in PNPMProxy to avoid workspace errors Jan 17, 2026
@valentinpalkovic valentinpalkovic self-assigned this Jan 26, 2026
@valentinpalkovic valentinpalkovic moved this to Empathy Queue (prioritized) in Core Team Projects Jan 27, 2026
@valentinpalkovic valentinpalkovic moved this from Empathy Queue (prioritized) to In Progress in Core Team Projects Jan 29, 2026
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@valentinpalkovic valentinpalkovic merged commit 306ba86 into storybookjs:next Jan 29, 2026
114 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Core Team Projects Jan 29, 2026
@ia319
Copy link
Copy Markdown
Member Author

ia319 commented Jan 29, 2026

Hi @valentinpalkovic , thanks for merging this PR.
I understand this means the team agrees with the Storybook-side fix for this issue.
I’m curious whether you’re aware of why this hasn’t been addressed on the npm side yet.
Thanks!

@github-actions github-actions bot mentioned this pull request Jan 30, 2026
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: Error: Cannot find @storybook/react-vite/package.json, Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@storybook/react-vite'

2 participants