0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pnpm で "Packages are hard linked from the content-addressable store to the virtual store." が発生した際の修復方法

0
Posted at

事象発生経緯

> pnpm update -g

を実行した際にエラー発生:

Packages: +1
+
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/<username>/Library/pnpm/store/v11
  Virtual store is at:             Library/pnpm/store/v11/links
Progress: resolved 1, reused 1, downloaded 0, added 1, done
[ENOENT] ENOENT: no such file or directory, open '/Users/<username>/Library/pnpm/global/v11/25ef-1a014794701-b45ad9b9ddfb6638/node_modules/@pnpm/exe/package.json'

pnpm: ENOENT: no such file or directory, open '/Users/<username>/Library/pnpm/global/v11/25ef-1a014794701-b45ad9b9ddfb6638/node_modules/@pnpm/exe/package.json'

直前で sudo npm update -g を実行してしまい、修復のために一旦丸ごと削除したが、一部参照が残ってしまったのが原因と考えられる。

環境

OS:macOS(Appleシリコン)
ターミナル:zsh
npm v12.0.2
pnpm v11.22.0

状態確認

1.バージョン確認


pnpm --version


出力例:11.22.0

2.パッケージ存在確認


brew list pnpm
brew info pnpm


出力例:

/opt/homebrew/Cellar/pnpm/11.22.0/bin/pnpm

pnpm ✔: stable 11.22.0 (bottled)

which pnpm

出力例:/opt/homebrew/bin/pnpm

3.グローバル依存確認
(今回の問題点)

pnpm list -g

Legend: production dependency, optional only, dev only

/Users/<UserName>/Library/pnpm/global/v11 (PRIVATE)
 │
 │  
dependencies:
└── @pnpm/exe@11.22.0


-->
@pnpm/exe@11.22.0 が Homebrew 管理の pnpm 本体とは別に global package として登録されてしまったようです。

修復方法

pnpm remove -g @pnpm/exe

結果確認

pnpm list -g
pnpm update -g

No global packages found が出力されていれば修復成功

そもそも @pnpm/exe とは?

Node.js のランタイムを内蔵した実行ファイル形式の pnpm CLI パッケージ。
システムに Node.js がインストールされていなくても pnpm を利用できるようにします。

なので、Node.js がインストールされているのであれば削除して構いません。
インストールされていない場合は

brew install node

を実行しておきましょう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?