0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

nvm node バージョン固定

Posted at

nodeのバージョン固定

nvmでnodeのバージョンを切り替えているのですが、WSLを再起動するたび元に戻ってしまうのでdefault設定をしたいと思います。

現状

バージョンを確認すると、v16が使われています。

node -v

# v16.20.1

今の開発環境では、v20.x.x.が必要なので以下の様にしています。

nvm use v20

# v20.0.0

ただし、WSLを再起動すると、v16に戻ってしまいます。

解決法

こちらを参考にdefault設定をします。

nvm alias default v*.*.*

v20に設定したいので以下を設定します。

nvm alias default v20.0.0

# default -> v20.0.0

default -> v20.0.0となりました。再起動し、node -vとすると、設定したv20.0.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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?