前提・実現したいこと
Rails 5.0.7
rails s をするとエラーが出ます。
発生している問題・エラーメッセージ
You've tried to invoke Spring when it's already loaded (i.e. the Spring constant is defined). This is probably because you generated binstubs with Spring 1.0, and you now have a Spring version > 1.0 on your system. To solve this, upgrade your bundle to the latest Spring version and then run `bundle exec spring binstub --all` to regenerate your binstubs. This is a one-time step necessary to upgrade from 1.0 to 1.1. Here's the backtrace: /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load' /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `block in load' /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency' /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load' /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>' /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require' /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require' /Users/username/projects/bookcafe-review-app/bin/spring:16:in `<top (required)>' bin/rails:5:in `load' bin/rails:5:in `<main>'
試したこと
以前は正常に動いていたのですが、直前にLaravelやpythonの環境構築をしてアプリを触っていました。
それ以外にRailsは全く触ってなかったのでそこらへんが問題ではないかと推測しています。
エラーメッセージにあるように
undle exec spring binstub --all
やこのエラーを調べた時、スプリングを一度停止させるなど試しましたがうまくいきませんでした。
そもそもspringは起動していませんでした。
また試しにbundle installするとspringがバージョンアップされてしまいたくさんbin以下にたくさんファイルが追加され
その状態でrails sすると
Beginning in Rails 4, Rails ships with a `rails` binstub at ./bin/rails that should be used instead of the Bundler-generated `rails` binstub. If you are seeing this message, your binstub at ./bin/rails was generated by Bundler instead of Rails. You might need to regenerate your `rails` binstub locally and add it to source control: rails app:update:bin # Bear in mind this generates other binstubs # too that you may or may not want (like yarn) If you already have Rails binstubs in source control, you might be inadvertently overwriting them during deployment by using bundle install with the --binstubs option. If your application was created prior to Rails 4, here's how to upgrade: bundle config --delete bin # Turn off Bundler's stub generator rails app:update:bin # Use the new Rails executables git add bin # Add bin/ to source control You may need to remove bin/ from your .gitignore as well. When you install a gem whose executable you want to use in your app, generate it and add it to source control: bundle binstubs some-gem-name git add bin/new-executable NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01. Gem::Specification#rubyforge_project= called from /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/specifications/erubis-2.7.0.gemspec:17. NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01. Gem::Specification#rubyforge_project= called from /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/specifications/rack-test-0.6.3.gemspec:17. NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01. Gem::Specification#rubyforge_project= called from /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/specifications/coderay-1.1.2.gemspec:21. NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01. Gem::Specification#rubyforge_project= called from /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/specifications/coffee-script-source-1.12.2.gemspec:16. Traceback (most recent call last): 8: from /Users/username/.rbenv/versions/2.5.1/bin/rails:23:in `<main>' 7: from /Users/username/.rbenv/versions/2.5.1/bin/rails:23:in `load' 6: from /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-6.0.2.2/exe/rails:10:in `<top (required)>' 5: from /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:35:in `require' 4: from /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:161:in `rescue in require' 3: from /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems.rb:208:in `try_activate' 2: from /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems.rb:215:in `rescue in try_activate' 1: from /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:1367:in `activate' /Users/username/.rbenv/versions/2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/specification.rb:2233:in `check_version_conflict': can't activate railties-5.0.7.2, already activated railties-6.0.2.2 (Gem::LoadError)
追記
rails app:update:bin
こちらのコマンドを実行したところエラーが発生しました。
rails
1LoadError: dlopen(/Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib 2 Referenced from: /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle 3 Reason: image not found - /Users/username/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle 4/Users/username/projects/bookcafe-review-app/config/application.rb:6:in `<top (required)>' 5/Users/username/projects/bookcafe-review-app/Rakefile:6:in `require_relative' 6/Users/username/projects/bookcafe-review-app/Rakefile:6:in `<top (required)>' 7/Users/username/projects/bookcafe-review-app/bin/rails:11:in `require' 8/Users/username/projects/bookcafe-review-app/bin/rails:11:in `<top (required)>' 9/Users/username/projects/bookcafe-review-app/bin/spring:16:in `<top (required)>' 10bin/rails:5:in `load' 11bin/rails:5:in `<main>' 12(See full trace by running task with --trace)
こんな感じになってしまいました。
springをgemから削除してbundle installし直すなど英語の資料で検索した結果も試しましたがどれも上手く行かずに困っております。
何かいい方法がございましたらご回答いただければ幸いです。