前提・実現したいこと
https://qiita.com/naoki_mochizuki/items/814e0979217b1a25aa3e
上記サイトを参考に、AWSにてRailsアプリのデプロイを実践中です。
経緯としては、もともとはうまく動いていたのですが、
上記サイトのアプリのsecret_key_baseの設定のところで、rake secretを実行すると、
You must use Bundler 2 or greater with this lockfile.
というエラーが出ました。
その件に関して、以下を実行
gem uninstall bundler gem install bundler -v 1.17.0 budle
すると、下記内容が表示されました
Traceback (most recent call last): 2: from /home/ak/.rbenv/versions/2.6.1/bin/bundle:23:in `<main>' 1: from /home/ak/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path' /home/aki/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /var/www/rails/testapp0512/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, run `bundle update --bundler`. To install the missing version, run `gem install bundler:2.0.2`
その後、下記を実行しrake secretはかえってくるようになりました。
rm Gemfile.lock bundle
その後からなのか、sshでログインしようとすると
-bash: rbenv: コマンドが見つかりません mkdir: ディレクトリ `/opt/rbenv/shims' を作成できません: 許可がありません mkdir: ディレクトリ `/opt/rbenv/versions' を作成できません: 許可がありません
といった表記がでるようになり、rubyのバージョンが
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
に下がってしまっていました。
そこから、元々入れていた2.6.1にしようとするのですが
[ak@ip-10-0-0-71 ~]$ rbenv install -v 2.6.1 /tmp/ruby-build.20190713011036.21010 ~ Downloading ruby-2.6.1.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.1.tar.bz2 Installing ruby-2.6.1... /tmp/ruby-build.20190713011036.21010/ruby-2.6.1 /tmp/ruby-build.20190713011036.21010 ~ mkdir: ディレクトリ `/opt/rbenv/versions' を作成できません: 許可がありません BUILD FAILED (Amazon Linux AMI 2018.03 using ruby-build 20190615-7-g0e9094b) Inspect or clean up the working tree at /tmp/ruby-build.20190713011036.21010 Results logged to /tmp/ruby-build.20190713011036.21010.log Last 10 log lines: /tmp/ruby-build.20190713011036.21010 ~ /tmp/ruby-build.20190713011036.21010/ruby-2.6.1 /tmp/ruby-build.20190713011036.21010 ~
といったエラーが出力されます。
ご存知の方がおられましたら、よろしくお願い致します。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/14 05:49
2019/07/17 23:31