🐱

Nodeのバージョン変わらない問題

2023/03/13に公開

原因

インストール先とアクティブ(使われる方)先が別々になっている。

installed : v18.13.0 to /usr/local/bin/node
active : v16.0.0 at /Users/yoshito/.nodebrew/current/bin/node

試したこと

$ vi ~/.bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

上記を消せばいいらしいがそもそも上記の文言が見当たらない

nodebrew install-binary stable 

しかしバージョン変わらず、、

yoshito@Mnhs00476 Astro % node -v
v16.0.0

どうやら使うバージョンを指定しなければいけないらしい

# なので安定版を指定
nodebrew use stable
yoshito@Mnhs00476 Astro % node -v
v18.13.0

無事成功🎉🎉

参考にした記事

https://qiita.com/Kintech/items/36f3f930c0a6f0c2db96
https://qiita.com/mame_daifuku/items/373daf5f49ee585ea498
https://qiita.com/Sr_Bangs/items/bda855068576905a441f

Discussion