Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

npm global install / uninstall blocked in yarn/pnpm project if npm enabled

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

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
nodejs, typescript
領域
cli, tooling

調査の方向性

issue にある再現コマンドから始めます。npm を有効にし、corepack use yarn で Yarn プロジェクトを作成して、npm install -g corepack@latest を実行するか、アンインストールします。README の「Manual Installs > Update Corepack using npm」セクションを読み、グローバルインストールの動作を追跡します。Yarn または pnpm プロジェクトで npm のグローバルインストールとアンインストールがブロックされない、またはその制限が明確に文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Current behavior

If Corepack is enabled for npm and an attempt is made to install Corepack globally when the current working directory (or hierachy above) contains a package.json with packageManager set to yarn or pnpm, then the installation of Corepack fails with a message similar to:

This project is configured to use yarn because /tmp/tmp.XVBPXUZMhT/package.json has a "packageManager" field

This also means that the instructions in the README > Manual Installs > Update Corepack using npm section fail in this situation.

Expected behavior

Global install of Corepack via npm should not be blocked when executing npm install -g or npm uninstall -g in a project configured for Yarn or pnpm and when Corepack is enabled for npm.

Alternatively, the restriction should be documented in the README.

Versions

Corepack 0.31.0
Ubuntu 24.04.2 LTS
Node.js 22.14.0 LTS

Steps to reproduce

export DEBUG=corepack
rm -rf ~/.cache/node/corepack
corepack enable npm
cd $(mktemp -d)
corepack use yarn
corepack -v
npm install -g corepack@latest
corepack -v

Logs

$ export DEBUG=corepack
rm -rf ~/.cache/node/corepack
corepack enable npm
cd $(mktemp -d)
corepack use yarn
corepack -v
npm install -g corepack@latest
corepack -v
Installing yarn@4.8.0 in the project...
  corepack Installing yarn@4.8.0 from https://repo.yarnpkg.com/4.8.0/packages/yarnpkg-cli/bin/yarn.js +0ms
  corepack Downloading to /home/mike/.cache/node/corepack/v1/corepack-5075-81fd1e1.d12d +1ms
  corepack LastKnownGood file would be located at /home/mike/.cache/node/corepack/lastKnownGood.json +280ms
  corepack No LastKnownGood version found in Corepack home. +1ms
  corepack Download and install of yarn@4.8.0 is finished +0ms
  corepack Checking /tmp/tmp.5Ay532aF12/package.json +0ms
  corepack Checking /tmp/package.json +0ms
  corepack Checking /package.json +0ms

➤ YN0000: · Yarn 4.8.0
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done in 0s 52ms
0.31.0
  corepack LastKnownGood file would be located at /home/mike/.cache/node/corepack/lastKnownGood.json +0ms
  corepack No LastKnownGood version found in Corepack home. +3ms
  corepack Search for default version: found in remote registry npm@11.2.0+sha512.3dc9c50ba813a3d54393155a435fe66404b72685ab0e3008f9ae9ed8d81f6104860f07ed2656dd5748c1322d95f3140fa9b19c59a6bba7750fd12285f81866da +1s
  corepack Setting npm@11.2.0+sha512.3dc9c50ba813a3d54393155a435fe66404b72685ab0e3008f9ae9ed8d81f6104860f07ed2656dd5748c1322d95f3140fa9b19c59a6bba7750fd12285f81866da as Last Known Good version +0ms
  corepack LastKnownGood file would be located at /home/mike/.cache/node/corepack/lastKnownGood.json +1ms
  corepack Checking /tmp/tmp.5Ay532aF12/package.json +1ms
This project is configured to use yarn because /tmp/tmp.5Ay532aF12/package.json has a "packageManager" field
0.31.0
主要言語
TypeScript
スター
3.8k
フォーク
279
平均マージ
1時間 47分
マージ済み PR(30日)
2

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

nodejs/corepack のほかの issue

nodejs/corepack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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