春季和中间件冲突? [英] Spring and middleware conflict?

查看:103
本文介绍了春季和中间件冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照这些说明<.

我在启动服务器时收到以下错误消息:

I'm receiving the following error message starting the server:

Exiting
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/omonia/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:287:in `load'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:287:in `block in load'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:259:in `load_dependency'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:287:in `load'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
/Users/omonia/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
/Users/omonia/Dropbox/MyApp/bin/spring:13:in `<top (required)>'

已安装的相关宝石:

gem 'google-api-client', '0.9'
gem 'omniauth'
gem 'omniauth-google_oauth2'

以下代码已添加到config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_oauth2, 'my Google client id', 'my Google client secret', {client_options: {ssl: {ca_file: Rails.root.join("cacert.pem").to_s}}}
end

这是怎么回事?按照错误说明进行任何更改(Spring的最新版本为1.7.2,并且运行bundle exec spring binstub --all只会返回已经存在的弹簧").

What is going on here? Following the error instructions doesn't change anything (Spring is of latest version 1.7.2 and running bundle exec spring binstub --all only returns "spring already present").

推荐答案

放入我的评论作为答案,因为OP确认确实对他有帮助.请按照以下步骤安装新的Spring并解决问题:

Putting my comment as answer, because OP confirmed that it did help him. Follow the steps below to install the new Spring and resolve the issue:

  • run this bin/spring binstub --remove --all
  • remove the gem from Gemfile and run bundle install.
  • Now add the gem "spring", group: :development in Gemfile, run bundle install and bundle exec spring binstub --all following doc. Now all should be fine.

这篇关于春季和中间件冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆