目次
文書の過去の版を表示しています。
pnpm - 高速、かつディスク容量効率が良いパッケージマネージャー
本家: Fast, disk space efficient package manager | pnpm (英語)
Fast, disk space efficient package manager | pnpm (日本語)
ソースコード: GitHub - pnpm/pnpm: Fast, disk space efficient package manager
ライセンス: MIT License
インストール
公式: インストール | pnpm
スタンドアロンスクリプトを使用してインストールする😉
$ curl -fsSL https://get.pnpm.io/install.sh | sh -
==> Downloading pnpm binaries 9.8.0
WARN using --force I sure hope you know what you are doing
Copying pnpm CLI from /tmp/tmp.mOCIb0d59q/pnpm to /home/tomoyan/.local/share/pnpm/pnpm
Appended new lines to /home/tomoyan/.zshrc
Next configuration changes were made:
export PNPM_HOME="/home/tomoyan/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
To start using pnpm, run:
source /home/tomoyan/.zshrc
$ . ~/.zshrc
公式: pnpm env <cmd> | pnpm
Node.js LTS をインストールする🤔
$ pnpm env add -g lts
Fetching Node.js 20.17.0 ... Node.js 20.17.0 was installed /home/tomoyan/.local/share/pnpm/nodejs/20.17.0 All specified Node.js versions were installed
Or
$ pnpm env use -g lts
Node.js 20.17.0 was installed /home/tomoyan/.local/share/pnpm/nodejs/20.17.0 Node.js 20.17.0 was activated /home/tomoyan/.local/share/pnpm/node -> /home/tomoyan/.local/share/pnpm/nodejs/20.17.0/bin/node
使い方
公式: GitHub - yoshi389111/dq2pswd: ふっかつのじゅもんを作れます。2の方です。
ここでは React アプリのサンプルとして、ドラクエⅡ🐉の「ふっかつのじゅもん2」を動かす😅
GitHub よりソースコードをクローン
$ git clone https://github.com/yoshi389111/dq2pswd.git
Cloning into 'dq2pswd'... remote: Enumerating objects: 204, done. remote: Counting objects: 100% (204/204), done. remote: Compressing objects: 100% (143/143), done. remote: Total 204 (delta 115), reused 147 (delta 58), pack-reused 0 (from 0) Receiving objects: 100% (204/204), 554.01 KiB | 4.86 MiB/s, done. Resolving deltas: 100% (115/115), done.
依存パッケージをインストール
$ cd dq2pswd $ pnpm install
Lockfile is up to date, resolution step is skipped Packages: +1258 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Progress: resolved 1258, reused 1258, downloaded 0, added 1258, done dependencies: + @testing-library/jest-dom 5.17.0 + @testing-library/react 13.4.0 + @testing-library/user-event 13.5.0 + @types/jest 27.5.2 + @types/node 16.18.112 + @types/react 18.3.10 + @types/react-dom 18.3.0 + react 18.3.1 + react-dom 18.3.1 + react-scripts 5.0.1 + typescript 4.9.5 + web-vitals 2.1.4 devDependencies: + @typescript-eslint/eslint-plugin 5.62.0 + @typescript-eslint/parser 5.62.0 + eslint 8.57.1 + eslint-config-prettier 8.10.0 + prettier 2.8.8 Done in 7.5s
トラブルシューティング
pnpm env add -g できない😅
anyenv - rbenv スタイルのオールインワン環境マネージャー でインストールした場合など、pnpm でNode.js の管理ができない😢
$ pnpm env add -g lts
ERR_PNPM_CANNOT_MANAGE_NODE Unable to manage Node.js because pnpm was not installed using the standalone installation script
If you want to manage Node.js with pnpm, you need to remove any Node.js that was installed by other tools, then install pnpm using one of the standalone scripts that are provided on the installation page: https://pnpm.io/installation
ERR_PNPM_CANNOT_MANAGE_NODE pnpm がスタンドアロン インストール スクリプトを使用してインストールされていないため、Node.js を管理できません
pnpm を使用して Node.js を管理する場合は、他のツールによってインストールされた Node.js をすべて削除し、インストール ページで提供されるスタンドアロン スクリプトの 1 つを使用して pnpm をインストールする必要があります: https://pnpm.io/installation
スタンドアロンスクリプトを使用してインストールし直す😉
$ npm uninstall -g pnpm
removed 1 package in 680ms
$ curl -fsSL https://get.pnpm.io/install.sh | sh -
==> Downloading pnpm binaries 9.8.0
WARN using --force I sure hope you know what you are doing
Copying pnpm CLI from /tmp/tmp.mOCIb0d59q/pnpm to /home/tomoyan/.local/share/pnpm/pnpm
Appended new lines to /home/tomoyan/.zshrc
Next configuration changes were made:
export PNPM_HOME="/home/tomoyan/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
To start using pnpm, run:
source /home/tomoyan/.zshrc
$ . ~/.zshrc
Node.js LTS をインストールする🤔
$ pnpm env add -g lts
Fetching Node.js 20.17.0 ... Node.js 20.17.0 was installed /home/tomoyan/.local/share/pnpm/nodejs/20.17.0 All specified Node.js versions were installed