Rails+Big Sur+pg和Spring冲突?

Rails + Big Sur + pg and Spring conflict?

升级到 Big Sur 后,启动服务器时 Ruby on Rails 中立即出现以下错误:

$ rails s
/Users/carsoncole/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/x86_64-darwin19/stringio.bundle:     warning: already initialized constant StringIO::VERSION
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/carsoncole/.rvm/gems/ruby-2.7.1/gems/bootsnap 1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `block in load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<main>'
/Users/carsoncole/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/carsoncole/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/carsoncole/scout_activity/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

我按照上面给出的指示进行操作,但无济于事。有什么想法吗?

如果我创建一个新的 Rails 应用程序,服务器可以正常启动。使用 Rails 6.0.3.4 和 Ruby 2.7.3

新应用和我现有的应用之间的一个区别是新应用没有使用 'pg'。当我将'pg' (pg-1.2.3) 添加到新应用程序时,出现同样的错误。

[更新] 我认为这个问题可能与 Homebrew 有关。我现在正在重新安装。

我找到了一个解决方案,虽然我不能确切地指出它为什么有效。

我重新安装了 Homebrew 和 Posgresql(带有 HB)。我还更新了 Xcode 和命令行库。在重新安装自制软件和 Xcode 的过程中,我相信许多库 updated/installed 我怀疑是问题所在。

现在工作正常。