[wrangler] Use project's package manager in wrangler setup#12437
Merged
[wrangler] Use project's package manager in wrangler setup#12437
Conversation
🦋 Changeset detectedLatest commit: f34f3d1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Claude finished @MattieTK's task —— View job Changeset Review
Typo in titleLine 5 contains a typo: "wranger" should be "wrangler" -fix: use project's package manager in wranger autoconfig
+fix: use project's package manager in wrangler autoconfigOther validation checks:
|
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
30855bc to
b3438c0
Compare
Member
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Generally looks good to me, thanks @MattieTK 🙂
I just left a few small comments all non blocking
It seems like the tests however need some fixing 🥲
b3438c0 to
35ebd5e
Compare
dario-piotrowicz
approved these changes
Feb 6, 2026
Member
dario-piotrowicz
left a comment
There was a problem hiding this comment.
LGTM, assuming that the CI failures are addressed of course
Thanks @MattieTK! 🫶
wrangler setup now detects the project's package manager from lockfiles and packageManager field instead of defaulting to npm. This fixes failures in pnpm/yarn workspace projects where npm cannot handle workspace: protocol. Leverages existing @netlify/build-info detection from framework analysis.
The AutoConfigDetailsBase type now requires packageManager, but several test files were constructing AutoConfigDetails without it. Also updated vi.mock calls to preserve NpmPackageManager export and fixed a consistent-type-imports lint violation in setup.test.ts.
08dcf96 to
f34f3d1
Compare
Merged
NuroDev
pushed a commit
that referenced
this pull request
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When users run
wrangler setupusing a package manager that doesn't match their project (e.g.npx wrangler setupin a pnpm workspace), the command fails because npm cannot handle theworkspace:protocol used by pnpm and yarn workspaces.The existing
getPackageManager()function relies onnpm_config_user_agentto detect which package manager invoked the command. When this doesn't match the project's actual package manager, autoconfig generates incorrect commands and may fail during dependency installation with errors like:npm error code EUNSUPPORTEDPROTOCOLfor workspace: protocolnpm error Cannot read properties of null (reading 'matches')This change detects the project's package manager from lockfiles and
packageManagerfield rather than from how wrangler was invoked.Why only in autoconfig?
This fix is scoped to
wrangler setuprather than changinggetPackageManager()globally because:@netlify/build-infois already a dependency here for framework detection, and itsProjectclass provides robust package manager detection as a side effect ofgetBuildSettings()