windows10環境でVagrantを用いてRailsの環境構築を行ったものの、自分の環境では一度vagrantを終了すると次にVagrantに入った時、railsコマンドを認識しなくなってしまうので備忘として再認識させる方法を残します。
環境
・windows10
・VagrantのboxはCentOS72
コマンド
vagrant sshでCentOSのターミナルに接続後、以下のコマンドを入力
source ~/.bash_profile
※自分の場合は一度suを実行後にやってます。
最初にプロファイルの読み込みが上手く行ってないのだろうか・・・。
追記(2018/09/02)
コメントでアドバイスいただきました。
どうやら~/.bash_profileにパスを通していたのが原因だった模様。
~/.bashrcにパスを通したらsourceコマンドを実行しなくてもrailsコマンドを認識した。
一応、以下のコマンドを実行した。
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
(スーパーユーザーで実行した。)
ちょっとしたことでも投稿してみるものだなぁ。。。