Ubuntuにbun, npm, yarn, pnpmをインストール
bun
公式サイト: https://bun.sh/
参考にしたインストール方法: https://bun.sh/docs/installation#installing
sudo apt-get install curl unzipcurl -fsSL https://bun.sh/install | bashsource ~/.bashrc
sudo apt-get install curl unzipcurl -fsSL https://bun.sh/install | bashsource ~/.zshrc
sudo apt-get install curl unzipcurl -fsSL https://bun.sh/install | bashsource ~/.config/fish/config.fish
npm (& node)
公式サイト: https://www.npmjs.com/
参考にしたインストール方法: https://github.com/nodesource/distributions#using-ubuntu-nodejs-current
sudo apt-get install curlcurl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -sudo apt-get install nodejs
yarn
公式サイト: https://classic.yarnpkg.com/en/
参考にしたインストール方法: https://classic.yarnpkg.com/en/docs/install#debian-stable
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarn-archive-keyring.gpg >/dev/nullecho "deb [signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.listsudo apt-get update && sudo apt-get install yarn
pnpm
公式サイト: https://pnpm.io/
参考にしたインストール方法: https://pnpm.io/installation#on-posix-systems
curl -fsSL https://get.pnpm.io/install.sh | sh -source ~/.bashrc
curl -fsSL https://get.pnpm.io/install.sh | sh -source ~/.zshrc
バージョンを確認
(tools=("node" "bun" "npm" "yarn" "pnpm") && \for tool in "${tools[@]}"; do version=$($tool --version 2>/dev/null || echo "not installed") printf "%-7s version: %s\n" "$tool" "$version"done)
2024 年 5 月 9 日時点では以下のような結果になりました。
node version: v22.1.0bun version: 1.1.7npm version: 10.7.0yarn version: 1.22.19pnpm version: 9.1.0
アンインストール
bun
https://bun.sh/docs/installation#uninstall
rm -rf ~/.bun
npm (& node)
sudo apt-get remove nodejs && sudo apt-get purge nodejs
yarn
sudo apt-get remove yarn && sudo apt-get purge yarn
pnpm
[ -n "$PNPM_HOME" ] && rm -rf "$PNPM_HOME" || echo "PNPM_HOME is not set, nothing to delete."