LoginSignup
37
26

More than 3 years have passed since last update.

nvmをインストールしたのに、-bash: nvm: command not foundになる。

Last updated at Posted at 2020-08-20

https://github.com/nvm-sh/nvm#install--update-script
こちらの

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

を使ってnvmをインストールし、特にエラーもなく完了したはずなのに

$ nvm --version


-bash: nvm: command not found
と言われた。

色々試した結果、

$ source ~/.nvm/nvm.sh

を実行することで解決。

頑張った末に、手順の下の方に”Troubleshooting on macOS”を見つけたので、ドキュメントを読むのが大事だと思いました。

追記(2020年8月21日)

このままだと、起動のたびに同じコマンドを叩かないといけなかったので、起動のたびに有効化してくれるように、/etc/profile.d/以下にシェルを置いておきます。

/etc/profile.d/nvm.sh

$ source ~/.nvm/nvm.sh

参考:https://www.yoheim.net/blog.php?q=20161202

37
26
1

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
37
26