Yarn command gates use the launcher version instead of the version selected by yarnPath

オープン
#3,327 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@jong-kyung がすでに取り組んでいます。

2026年11月3日 から。

  • #3329 @voidzero-bot による — マージされずにクローズ

評価

この issue はまだ評価されていません。

説明

- P2: has workaround

Problem

Vite+ selects Yarn behavior from the version in packageManager, which is the launcher it downloads. However, the launcher hands the command to the release in yarnPath unless ignorePath or YARN_IGNORE_PATH disables that delegation. When the two versions differ, Vite+ makes its decision for a version that does not run the command.

The most serious result is a silent false success. With packageManager: "[email protected]" and yarnPath pointing to Yarn 3.8.7, vp unlink prints a warning and exits with code 0, but the portal: resolution stays in package.json. Running the same launcher directly removes it. This was found in the review of #3286.

Reproduction

These steps need the unlink gate from #3286.

  1. Set "packageManager": "[email protected]" in package.json.
  2. Copy bin/yarn.js from @yarnpkg/[email protected] to .yarn/releases/yarn-3.8.7.cjs.
  3. Create .yarnrc.yml with nodeLinker: node-modules and yarnPath: .yarn/releases/yarn-3.8.7.cjs.
  4. Run vp install.
  5. Create ../linked-lib/package.json with the name linked-lib, then run vp link ../linked-lib.
  6. Run vp unlink linked-lib.

Expected: Yarn 3 removes the linked-lib resolution from package.json.

Actual: Vite+ prints this warning and exits with code 0, and the resolution stays.

warn: yarn unlink requires Yarn Classic or yarn >= 3.0.0. Skipping.

Affected checks

Result of a mismatch Checks Launcher and effective version Source
Skips a supported command unlink, patch-commit --save (Yarn 3) 2.x and 3 or later #3286
Skips a supported command audit (Yarn 2.4) Below 2.4 and 2.4 or later #3286
Skips a supported command patch, patch-commit, rebuild, whoami Classic and Berry main
Skips a supported command list, licenses, team Berry and Classic main
Falls back to npm stage (Yarn 4.16) Below 4.16 and 4.16 or later main
Rejects a supported option not_supported(yarn ...) rules with version conditions Depends on the rule Mostly main
Builds arguments for the wrong Yarn family is_berry() branches Classic and Berry main
Sends a setting the effective Yarn rejects YARN_ENABLE_TIPS in resolve_for_manager 4.x and 2.x or 3.x main

This table comes from reading the code. Only the Yarn 2 launcher delegating to Yarn 3 has been reproduced end to end. The Classic and Berry rows, and whether the Classic launcher delegates in the same way, still need to be confirmed.

Possible direction

An earlier attempt in #3286 (eb4b2c713) ran yarn --version before every Yarn command. It is accurate because Yarn applies its own configuration rules, but it adds a process to every command.

A cheaper option is to resolve with the launcher version first and query the effective version only when Vite+ declines the request, which means a Noop, an InvalidArgument, or a FallbackCommand diagnostic. If the query reports a different version, Vite+ resolves again. Commands that run need no query because Yarn reports its own errors.

This option would not fix the is_berry() argument branches or YARN_ENABLE_TIPS, because those affect commands that do run. Reading the version from the yarnPath file name avoids a process, but the name can be arbitrary, and it would not account for parent or home configuration files or environment overrides.

主要言語
Rust
スター
6.5k
フォーク
297
平均マージ
1日 3時間
マージ済み PR(30日)
245

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

voidzero-dev/vite-plus のほかの issue

voidzero-dev/vite-plus の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。