LoginSignup
1
1

More than 3 years have passed since last update.

【AWS・EC2】メッセージ「コマンドが見つかりません」の対処法

Last updated at Posted at 2020-04-20

エラー内容

[shogo@ip-10-0-0-58 Portfolio]$ bundle exec rake secret
bash: bundle: コマンドが見つかりません

ruby -vをしてもコマンドが見つかりません、とのこと。

解決法

以下を上から順に試す。

[shogo@ip-10-0-0-58 Portfolio]$ cd 
[shogo@ip-10-0-0-58 ~]$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv 
(#rbenvのインストール) 
[shogo@ip-10-0-0-58 ~]$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile 
(#パスを通す)
[shogo@ip-10-0-0-58 ~]$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
[shogo@ip-10-0-0-58 ~]$ source .bash_profile  
(#.bash_profileの読み込み)
[shogo@ip-10-0-0-58 ~]$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
(#ruby-buildのインストール)
[shogo@ip-10-0-0-58 ~]$ rbenv rehash  
(#rehashを行う) 

一度EC2からログアウトするとパスが通らなくなるのが原因かもしれません。

後、ユーザーも関係している可能性があります。
(私の場合、ec2-userで上記コマンドを実行してもうまくパスが通りませんでした。)

間違っていたらコメントください。
勉強中のため詳しい方がいましたら教えていただければと思います。

参考
https://qiita.com/naoki_mochizuki/items/814e0979217b1a25aa3e

1
1
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
1
1