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

前端之家收集整理的这篇文章主要介绍了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

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

猜你在找的Ruby相关文章