ruby-on-rails – “bundle exec spring”不能与rbenv一起使用?

为什么不绑定exec spring工作?

我已经调用bundle exec,并返回一个错误.我可以随时调用bundle exec. (这是可能的重复问题的解决方案).

我不会通过捆绑更新弹簧更新我的Gemfile或卸载一个版本的spring来使这项工作.我不应该被迫改变我的宝石安装.

bundle binstubs弹簧也不工作.

steve-air:finalcloud main$spring -v
Spring version 1.3.5
steve-air:finalcloud main$bundle exec spring -v
Spring version 1.3.4
steve-air:finalcloud main$bundle exec spring
/Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.5,but your Gemfile requires spring 1.3.4. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:19:in `setup'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:122:in `setup'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.7/lib/bundler/setup.rb:8:in `<top (required)>'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.5/lib/spring/commands.rb:33:in `<module:Spring>'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.5/lib/spring/commands.rb:4:in `<top (required)>'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.5/lib/spring/server.rb:9:in `<top (required)>'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
  from /Users/main/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'

要复制:

有Ruby安装rebenv.
>卸载所有的Spring宝石.
>安装一个较低版本的Spring(如1.3.4).
>制作一个新的Rails应用程序
>安装更高版本的Spring(1.3.5似乎已经消失了,但是我用1.3.6复制了).
>按照我上面的命令行中的步骤.

解决方法

经过一番探索,似乎有几件事情在这里玩耍:

>系统安装宝石通过bundler安装宝石和特殊行为rails
>在rvm和bundle级别生成binstub
>在Spring 1.3.5中有奇怪的行为

这个问题的根本原因似乎是https://github.com/rails/spring/issues/295,固定在1.3.6.见:https://github.com/rails/spring/blob/master/CHANGELOG.md#136

可悲的是,事实证明,您无法解决这个问题,作者在问题中指定的限制.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...