2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WSL Ubuntuにnodenvにinstallする方法

Last updated at Posted at 2024-03-14

WSL Ubuntuにnodenvにinstallする方法

WSL Ubuntuにnodenvをinstallする方法

updateとupgrade

sudo apt update && sudo apt upgrade -y

nodenvのinstall

git clone https://github.com/nodenv/nodenv.git ~/.nodenv
cd ~/.nodenv && src/configure && make -C src
# 環境変数の設定
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(nodenv init -)"' >> ~/.bashrc

pluginのinstall

cd ~/.nodenv
mkdir plugins
cd plugins
git clone https://github.com/nodenv/node-build.git
# SHELLを再起動
exec $SHELL

nodeをinstall

# nodeのinstall可能なバージョンをリスト表示
nodenv install --list
# nodeの特定のバージョンをinstall
nodenv install 18.12.1
# グローバルで有効化
nodenv global 18.12.1
# ローカルで有効化
nodenv local 18.12.1 # .node-versionにバージョン情報が書き出される

以上。上から順番に実行するだけ。

2
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?