LoginSignup
0
0

More than 1 year has passed since last update.

nodeのアップデート方法(nodenv)

Posted at

nodenv環境でnodeをアップデートする方法です。
nodenv installをしたらdefinition not foundと言われた時のメモです。

まずは、 .node-versionsファイルのバージョンを変えます。

次に、nodenodenvを見ているかどうかを確認します。
以下のように出力されたらOK

% which node
/Users/okada/.nodenv/shims/node

nodebrewを向いている場合は、nodebrewをアンインストールします。

次に、インストールしたいバージョンを指定して実行してみます。

% nodenv install 18.12.1

installできるリストに入っていないようです :cry:

node-build: definition not found: 18.12.1

See all available versions with `nodenv install --list'.

If the version you need is missing, try upgrading node-build:

  brew update && brew upgrade node-build

メッセージにあるように↓を実行してみます。

% nodenv install --list
・
・
・
18.8.0
18.9.0
18.9.1
chakracore-dev
・
・
・

確かにいませんね。
言われたとおりに↓を実行します

% brew update && brew upgrade node-build

成功したのでもう一度リストを確認。増えました :thumbsup:

% nodenv install --list
・
・
・

18.8.0
18.9.0
18.9.1
18.10.0
18.11.0
18.12.0
18.12.1
19.0.0
19.0.1
chakracore-dev
・
・
・

もう一度インストール!

% nodenv install 18.12.1

エラー無くインストールできたのでバージョン確認 :ok_woman:

% node -v
v18.12.1

エラーメッセージのとおりに実行しただけですが…
nodeのアップデートっていつもどうやるのか忘れるので、備忘録を兼ねて書きました。

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