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 on Fish Shell】Fish Shellでnvmをインストールする備忘録

Posted at

Claude Codeをwslで使おうと思ったため、Fish Shell上でnvmをインストールしようとしたら詰まったので備忘録を残す。

インストールできない

通常bashの場合

通常のbashでnvmをインストールするコマンドは次のとおりである。

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

このコマンドでは、nvmのインストールコマンドをダウンロードして実行している。
そして、install.shでは、~/.profileに次の環境変数を書き込んでいる。

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

内容としては、nvmのインストールしている場所をNVM_DIRという変数に置き、その後$NVM_DIR/nvm.shを実行することで、wsl起動時にnvmを読み込んでいる。

しかしfish shellでは...

シェルをbashからfishに変更すると、wsl起動時に.profileが読み込まれなくなる(代わりに.config/fish/config.fishが使用される)ので、起動時にnvm.shを実行できなくなってしまう。

解決

有志がfish-nvmというパッケージを公開してくれているのでそれを使用する。
(.config/fish/config.fishnvm.shを読み込む設定を書き込んでもいけるかも?未検証)

fish-nvmインストール

fisher

$ fisher install FabioAntunes/fish-nvm edc/bass

oh-my-fish

$ omf install https://github.com/fabioantunes/fish-nvm
$ omf install https://github.com/edc/bass

これでnvmコマンドがfish shellでも実行できるようになる。

参考

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?