諸々の作業を行っていたところ、タイトルのエラーが発生

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/rubygems/rubygems/search?q=Permission+denied+%40+rb_sysopen+-+%2FUsers%2Fmasahirookubo%2F.rbenv%2Fversions%2F2.7.2%2Flib%2Fruby%2Fgems%2F2.7.0%2Fgems%2Ftzinfo-2.0.4%2F.yardopts&type=Issues

If there aren't any reports for this error yet, please copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md

上記エラーが出て、こちらの権限を直しても結果変わらずでした
※元々権限は問題なかった

sudo chown -R ユーザー名 ~/.bundle
sudo chown -R ユーザー名 ~/.gem

そして次にできることは?と考えて、エラーを漁って見ることにしました

特にこの部分はデコードしたらいい感じのエラー出てきそうで、

First, try this link to see if there are any existing issue reports for this error:
https://github.com/rubygems/rubygems/search?q=Permission+denied+%40+rb_sysopen+-+%2FUsers%2Fmasahirookubo%2F.rbenv%2Fversions%2F2.7.2%2Flib%2Fruby%2Fgems%2F2.7.0%2Fgems%2Ftzinfo-2.0.4%2F.yardopts&type=Issues

デコードした結果 (こちらのサイト使いました:URL)こんな感じの有益な情報に変換され、
どうやら、tzinfo が問題っぽいことがわかります

https://github.com/rubygems/rubygems/search?q=Permission denied @ rb_sysopen - /Users/masahirookubo/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/tzinfo-2.0.4/

上記の権限のあたりについては問題ないことがわかっているので、こちらのgemを

sudo gem install tzinfo

でinstallしてから

bundle install

をしたところ、全て問題なくinstallすることができました

ちなみにですが、他のRailsプロジェクトで同様のエラーが出たら、私の場合こちらで解決できました🙏

bundle update

参考記事

rails newでUnfortunately, an unexpected error occurred, and Bundler cannot continue.が表示

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA