3
1
記事投稿キャンペーン 「2024年!初アウトプットをしよう」

【pnpm】pnpm自体をアップデートする

Posted at

pnpm installを実行した際に、アップデートのお知らせが出たので、pnpm自体をアップデートしたときの手順をまとめます。

   ╭──────────────────────────────────────────────────────────────────╮
   │                                                                  │
   │                Update available! 8.14.0 → 8.14.1.                │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v8.14.1   │
   │                Run "pnpm add -g pnpm" to update.                 │
   │                                                                  │
   │      Follow @pnpmjs for updates: https://twitter.com/pnpmjs      │
   │                                                                  │
   ╰──────────────────────────────────────────────────────────────────╯

上記のようなお知らせが出たので、指示通り、 pnpm add -g pnpm を実行すると、エラーがでました。

Nothing to stop. No server is running for the store at /Users/XXXX/Library/pnpm/store/v3
 ERR_PNPM_NO_GLOBAL_BIN_DIR  Unable to find the global bin directory

Run "pnpm setup" to create it automatically, or set the global-bin-dir setting, or the PNPM_HOME env variable. The global bin directory should be in the PATH.

どうやら、pnpm setupを実行せよ、とのこと。
実行すると、以下のように表示される。

% pnpm setup
Appended new lines to /Users/XXXXX/.zshrc

Next configuration changes were made:
export PNPM_HOME="/Users/XXXXX/Library/pnpm"
case ":$PATH:" in
  *":$PNPM_HOME:"*) ;;
  *) export PATH="$PNPM_HOME:$PATH" ;;
esac

To start using pnpm, run:
source /Users/XXXXX/.zshrc

設定が書き換えられたようなので、再読み込みをおこなう。

% source /Users/XXXXX/.zshrc

再度、アップデートするコマンドを実行すると、成功する。

% pnpm add -g pnpm             
Nothing to stop. No server is running for the store at /Users/XXXXX/Library/pnpm/store/v3
The location of the currently running pnpm differs from the location where pnpm will be installed
 Current pnpm location: /opt/homebrew/bin
 Target location: /Users/XXXXX/Library/pnpm

Packages: +1
+
Progress: resolved 1, reused 0, downloaded 1, added 1, done

/Users/XXXXX/Library/pnpm/global/5:
+ pnpm 8.14.1

Done in 1s
3
1
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
3
1