简体   繁体   English

脚手架新 Ruby on Rails 应用程序导致 spring 错误

[英]Scaffolding new Ruby on Rails app leads to spring error

I had tried to run a Rails app locally after finding that a deployed version of it had stopped running, but I got the error below.在发现它的已部署版本已停止运行后,我曾尝试在本地运行 Rails 应用程序,但出现以下错误。 Puzzled, I tried to scaffold a new Rails app and got the same error.困惑的是,我试图搭建一个新的 Rails 应用程序并得到同样的错误。 Any help would be much appreciated.任何帮助将非常感激。

Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4).
We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.
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:

/home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
/home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
/home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:319:in `block in load'
/home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:319:in `load'
/home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<main>'
/home/user/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/home/user/.rbenv/versions/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/home/user/code/rails-who/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Have you following the warning message instructions?您是否遵循警告信息说明?

Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4).
We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.1.4`.
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.

I would try the two things suggested in the warning messages:我会尝试警告消息中建议的两件事:

1.) Run the command gem install bundler:2.1.4 1.) 运行命令gem install bundler:2.1.4

2.) Regenerate your binstubs bundle exec spring binstub --all 2.) 重新生成你的 binstubs bundle exec spring binstub --all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM