Skip to content

[wrangler] Fix init --from-dash with Yarn Classic#12280

Merged
petebacondarwin merged 4 commits intomainfrom
fix/8269-yarn-classic-init
Feb 5, 2026
Merged

[wrangler] Fix init --from-dash with Yarn Classic#12280
petebacondarwin merged 4 commits intomainfrom
fix/8269-yarn-classic-init

Conversation

@penalosa
Copy link
Copy Markdown
Contributor

@penalosa penalosa commented Jan 29, 2026

Fixes #8269.

When using Yarn Classic (v1.x), running wrangler init or wrangler init --from-dash would fail because Yarn Classic doesn't properly handle version specifiers with special characters like ^ in yarn create commands. Yarn would install the package correctly but then fail to find the binary because it would look for a path like .yarn/bin/create-cloudflare@^2.5.0 instead of .yarn/bin/create-cloudflare.

This fix removes the version specifier from the default C3 command entirely. Since C3 has had auto-update behavior for over two years, specifying a minimum version is no longer necessary and removing it resolves the Yarn Classic compatibility issue.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: This is a bug fix that restores expected behavior

Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 29, 2026

🦋 Changeset detected

Latest commit: de4cd06

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

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 29, 2026

Claude finished @penalosa's task —— View job


Changeset Review

All changesets look good

The changeset .changeset/fix-yarn-classic-init.md meets all requirements:

  1. Version Type: ✅ Correctly marked as patch (bug fix)
  2. Changelog Quality: ✅ Clear, descriptive explanation of the bug and the fix with good context
  3. Markdown Headers: ✅ No h1/h2/h3 headers used
  4. Analytics: ✅ No analytics changes
  5. Experimental Features: ✅ Not applicable

The changeset provides excellent detail about both the problem (Yarn Classic's handling of version specifiers) and the solution (removing the version specifier since C3 has auto-update behavior).


@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 29, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12280

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12280

miniflare

npm i https://pkg.pr.new/miniflare@12280

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12280

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12280

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12280

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12280

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12280

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12280

wrangler

npm i https://pkg.pr.new/wrangler@12280

commit: de4cd06

@penalosa
Copy link
Copy Markdown
Contributor Author

@claude this is a pretty complex fix. Instead, I'd like to change the default C3 command in Wrangler to not include a version specifier. C3 has had auto-update behaviour for over two years now, and so specifying a version is no longer needed.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 29, 2026

Claude finished @penalosa's task —— View job


Simplifying C3 Command Approach ✅

Good point! Since C3 has auto-update behavior, we can simplify this significantly by just removing the version specifier entirely.

Todo List:

  • Read current implementation to understand changes needed
  • Simplify C3 command to remove version specifier
  • Remove Yarn-specific helper functions
  • Update tests to reflect new behavior
  • Update changeset description
  • Run checks and push changes

Changes implemented:

  1. Removed version specifier from default C3 command: Changed "create cloudflare@^2.5.0" to "create cloudflare" in misc-variables.ts:37
  2. Removed complex Yarn logic: Eliminated the isYarn() and sanitizeC3ArgsForYarn() functions from init.ts (22 lines removed)
  3. Updated tests: Updated all test expectations to reflect the simpler command without version specifiers
  4. Updated changeset: Revised the description to explain the simpler approach using C3's auto-update behavior

This approach is much cleaner than the original complex detection logic and resolves the Yarn Classic issue by simply removing the problematic version specifier entirely. Since C3 has had auto-update behavior for over two years, the version specifier was no longer necessary anyway.

Files modified:

  • packages/workers-utils/src/environment-variables/misc-variables.ts
  • packages/wrangler/src/init.ts
  • packages/wrangler/src/__tests__/init.test.ts
  • .changeset/fix-yarn-classic-init.md

Changes have been committed and pushed to the PR branch.


@penalosa
Copy link
Copy Markdown
Contributor Author

@claude fix CI checks

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 29, 2026

Claude finished @penalosa's task —— View job


Fix CI Checks ✅

  • Check current git status and recent changes
  • Install dependencies and build packages
  • Run code quality checks to identify failures
  • Fix any linting/formatting issues
  • Fix any type errors
  • Fix any test failures
  • Verify all checks pass
  • Commit and push fixes

Issues found and fixed:

  1. Documentation inconsistencies: Updated comments in factory.ts and misc-variables.ts to reflect the new default command "create cloudflare" instead of the old "create cloudflare@^2.5.0"

  2. Formatting issue: Removed an extra blank line in init.ts

The core logic of your PR was correct - these were just documentation and formatting inconsistencies that would cause linting failures. The CI checks should now pass.

Changes committed and pushed:

  • packages/workers-utils/src/environment-variables/factory.ts
  • packages/workers-utils/src/environment-variables/misc-variables.ts
  • packages/wrangler/src/init.ts

@penalosa penalosa marked this pull request as ready for review January 30, 2026 13:43
@penalosa penalosa requested a review from a team as a code owner January 30, 2026 13:43
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Feb 4, 2026
penalosa and others added 4 commits February 5, 2026 13:15
Yarn Classic (v1.x) doesn't properly handle version specifiers with
special characters like ^ in yarn create commands. It installs the
package correctly but fails to find the binary because it looks for
a path like .yarn/bin/create-cloudflare@^2.5.0 instead of
.yarn/bin/create-cloudflare.

This fix strips version specifiers from the C3 command when using Yarn,
allowing Yarn to install and run the latest compatible version of
create-cloudflare.

Fixes #8269
Remove version specifier from default C3 command since C3 has auto-update
behavior. This resolves Yarn Classic compatibility issues without complex
package manager detection logic.

Co-authored-by: Somhairle MacLeòid <penalosa@users.noreply.github.com>
- Update comment in factory.ts to reflect new default command
- Update comment in misc-variables.ts to reflect new default command
- Remove extra blank line in init.ts

Co-authored-by: Somhairle MacLeòid <penalosa@users.noreply.github.com>
@petebacondarwin petebacondarwin force-pushed the fix/8269-yarn-classic-init branch from 35384d5 to de4cd06 Compare February 5, 2026 13:15
@petebacondarwin petebacondarwin merged commit 988dea9 into main Feb 5, 2026
40 of 41 checks passed
@petebacondarwin petebacondarwin deleted the fix/8269-yarn-classic-init branch February 5, 2026 15:50
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 BUG: yarn wrangler init --from-dash broken

4 participants