LoginSignup
0
0

More than 1 year has passed since last update.

nodenv で Node.js のバージョンを切り替える

Last updated at Posted at 2023-04-01

Node.js の version 切り替えをしたかったので nodenv を入れてみました。

準備

$ brew install nodenv
$ vim ~/.zshrc

# vim に書き込む
export PATH="/opt/homebrew/opt/nodenv/bin:$PATH"
eval "$(nodenv init -)"

コマンド一覧

# インストール可能な Node.js のバージョン一覧
$ nodenv install -l

# install
$ nodenv install <version>

# nodenvに認識させる
$ nodenv rehash

# install 済みの Node.js を確認
$ nodenv versions

# ローカルで利用する Node.js のバージョンを設定する
$ nodenv local <version>

# グローバルで利用する Node.js のバージョンを設定する
$ nodenv global <version>

最後に確認してみる

OK!!

$ nodenv versions      
* 16.18.0 (set by /Users/l016/.nodenv/version)
  18.2.0
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