Spring is broken with bundler >= 1.11.0 #456

Closed
ojab opened this Issue Dec 16, 2015 · 36 comments

Projects

None yet
@ojab
ojab commented Dec 16, 2015

After bundler/bundler#4002 (which is included into 1.11.0 and up) bundler restores RUBYLIB env var, but it seems that spring actually needs former behavior.
spring-1.6.0 (rails-4.2.5) w/ bundler >= 1.11.0 fails like this:

ojab-notebook:dashboard-ng ojab$ bundle exec rails c
/Users/ojab/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
    from /Users/ojab/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/commands.rb:33:in `<module:Spring>'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/commands.rb:4:in `<top (required)>'
    from /Users/ojab/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/ojab/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:77:in `preload'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:143:in `serve'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:131:in `block in run'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:125:in `loop'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/application.rb:125:in `run'
    from /Users/ojab/Documents/repos/phones/dashboard-ng/vendor/bundle/ruby/2.2.0/gems/spring-1.6.0/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/ojab/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/ojab/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'

sping app/server starts fine:

ojab            23200   0.1  0.1  2480972  11048   ??  Ss    4:38PM   0:00.12 spring app    | dashboard-ng | started 9 secs ago | development mode
ojab            23198   0.0  0.3  2505632  23612 s005  S     4:38PM   0:00.32 spring server | dashboard-ng | started 9 secs ago

Issue for bundler is filled (bundler/bundler#4165), but I'm not really sure that it is their bug.

@ojab
ojab commented Dec 16, 2015

…and looks like #453 fixes the issue.

@ojab ojab referenced this issue in bundler/bundler Dec 16, 2015
Closed

1.11.0/1.11.1 rails generate controller fails #4165

@sonalkr132
Contributor

Yes it does 😁
I added following to my gemfile:

gem 'spring', github: 'sonalkr132/spring', branch: 'bundler-dep'

and didn't get any error.

@sonalkr132 sonalkr132 added a commit to sonalkr132/spring that referenced this issue Dec 19, 2015
@sonalkr132 sonalkr132 Add bundler Dependency to gemspec, closes #456 1d24bf5
@jonleighton
Member

#453 has been superseded by #458. However I don't really understand how it solves this issue? Can anyone explain what the issue was and why changing out gemfile solves it?

@ratracegrad

I am running into the error that I cannot generate a new controller/model/etc on my new installation of rails on my Mac because I am getting the errors:
rails g controller test1
/Users/jenniferbland/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- bundler/setup (LoadError) from /Users/jenniferbland/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /Users/jenniferbland/Documents/projects/lynda/ruby4/Sites/simple_cms/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:33:in `module:Spring'
....
If I comment out the gem 'spring' line in my Gemfile everything works perfectly.

If I change the line to gem 'spring', github: 'sonalkr132/spring', branch: 'bundler-dep' as was mentioned above it installs spring and everything works perfectly.

So how do I get a new version of spring installed that will install and not generate the error message I am receiving when generating a new model/controller?

@morgoth
Contributor
morgoth commented Dec 28, 2015

I also have this error on travis and confirm that #458 fixes it

@turboladen

I'm also getting the same error with ruby 2.3, rubygems 2.5.1, bundler 1.11.2, rails 4.2.5, and spring 1.6.0 (or 1.6.1). I tried @sonalkr132 's solution: while I'm no longer getting the error, I'm also not getting the benefit of spring. For example, I bin/rake spec and see warnings and such that I get when the app is booting; I run the same again and see the same warnings. bundle exec spring status also shows Spring is not running.

@chrishough

@sonalkr132 I tried your version and it is still failing

@sonalkr132
Contributor

@chrishough #458 isn't really a solution for it. It just so happens that it works some of the times.

#462 removes the line which is causing this error and it is pending review.

@chrishough

np @sonalkr132 -- I commented out spring for now to get around it.

@Chocobozzz Chocobozzz added a commit to Chocobozzz/Diaspora-Docker that referenced this issue Jan 8, 2016
@Chocobozzz Chocobozzz Disable dev test unless rails/spring#456 is
not fixed
16d1da6
@jonleighton jonleighton added a commit that referenced this issue Jan 8, 2016
@jonleighton jonleighton Print "Running via Spring preloader" message from the app process
Rather than from the Spring client process. See
https://github.com/rails/spring/pull/455/files#r48411471

Within the app process, we'll have access to the spring config, to see
whether Spring.quiet has been set.

This means we can remove the spring/commands require from the client
side, which should never have been added and caused problems (#456, #457).

I'm getting rid of the feature which omits this message when run
manually (i.e. `spring rails runner ...` rather than `bin/rails runner
...`) because:

1. It makes the implementation more complicated
2. YAGNI
0a80019
@jonleighton
Member

Does v1.6.2 (just released) solve this?

@turboladen

1.6.2 seems to get around crashes for me! I'm on chruby 0.3.9, ruby-install 0.6.0 (not sure if that matters), running ruby 2.3.0 and rails 4.2.5. Spring 1.6.0 and 1.6.1 were problematic for me.

Just one thing... I see Running via Spring preloader in process [X] when i bin/rails c or bin/rake (anything), but nothing similar when i bin/rails s--is that expected? Boot time of bin/rails s is definitely consistently longer than the other commands, leading me to believe that sprint is not working for that command.

@jonleighton
Member

Great, closing this then.

Just one thing... I see Running via Spring preloader in process [X] when i bin/rails c or bin/rake (anything), but nothing similar when i bin/rails s--is that expected? Boot time of bin/rails s is definitely consistently longer than the other commands, leading me to believe that sprint is not working for that command.

Spring deliberately doesn't get involved in the rails server command. See #72.

@jonleighton jonleighton closed this Jan 9, 2016
@freswa
freswa commented Jan 10, 2016

1.6.2 does not fix Issue bundler/bundler#4165 which might be a spring bug too and is already mentioned above.

@ojab
ojab commented Jan 11, 2016

1.6.2 still crashes for me too, please reopen.

@jonleighton
Member

Is the backtrace the same as before?

@jonleighton jonleighton reopened this Jan 11, 2016
@ojab
ojab commented Jan 11, 2016

yep, backtrace is the same.

@winston winston referenced this issue in rubycentral/cfp-app Jan 11, 2016
Merged

Update ruby gems #74

@turboladen

@jonleighton πŸ‘

@tadejm tadejm added a commit to HouseTrip/deploylist that referenced this issue Jan 12, 2016
@tadejm tadejm Disable `spring`
Re-enable when rails/spring#456 is resolved.
0cf84f9
@vincedevendra vincedevendra added a commit to vincedevendra/cfp-app that referenced this issue Jan 13, 2016
@winston @vincedevendra winston + vincedevendra Update ruby gems.
Spring 1.6.2 fixed the issue of rails/spring#456
d51d275
@sonalkr132
Contributor

bundler restores RUBYLIB env var, but it seems that spring actually needs former behavior.

This is the problem indeed.
In bundler 1.10.6, $LOAD_PATH looked like:

/home/user/testapp/vendor/bundle/ruby/2.2.0/gems/spring-1.6.2/lib
/home/user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib    # Look for this line in next snippet
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/x86_64-linux
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0/x86_64-linux
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-linux

and in bundler 1.11.2, $LOAD_PATH is:

/home/user/testapp/vendor/bundle/ruby/2.2.0/gems/spring-1.6.2/lib
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/x86_64-linux
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0/x86_64-linux
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0
/home/user/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-linux

bundler line was in ENV["RUBYLIB"] but bundler 1.11.0+ deletes it here.

@pocke pocke referenced this issue in skyarch-networks/skyhopper Jan 21, 2016
Merged

Use spring. #196

5 of 6 tasks complete
@sonalkr132
Contributor

So, culprit is this line:

paths  = Gem.path + ENV["GEM_PATH"].to_s.split(File::PATH_SEPARATOR)

Here, ENV["GEM_PATH"] is empty string. This is why both GEM_PATH and GEM_HOME has the same value:

/home/user/.rvm/gems/ruby-2.2.1

when former should be:

/home/user/.rvm/gems/ruby-2.2.1:/home/user/.rvm/gems/ruby-2.2.1@global

I checked ENV.to_hash and ENV["_ORIGINAL_GEM_PATH"] seems to have the required path, however I am not sure if I can use that. Suggestions?

cc: @jonleighton , @grosser

@sonalkr132 sonalkr132 added a commit to sonalkr132/spring that referenced this issue Jan 23, 2016
@sonalkr132 sonalkr132 Start server process in clean env, closes #456
ENV["GEM_PATH"] was empty string, so GEM_PATH and GEM_HOME passed to
server process were same path.
It used to work before bundler 1.11.0 release cause bundler didn't clean
ENV["RUBYLIB"] and `require bundler/setup` was using that instead.
Change in bundler: bundler/bundler#4002
33f333b
@sonalkr132 sonalkr132 added a commit to sonalkr132/spring that referenced this issue Jan 23, 2016
@sonalkr132 sonalkr132 Start server process in clean env, closes #456
ENV["GEM_PATH"] was empty string, so GEM_PATH and GEM_HOME passed to
server process were same path.
It used to work before bundler 1.11.0 release cause bundler didn't clean
ENV["RUBYLIB"] and `require bundler/setup` was using that instead.
Change in bundler: bundler/bundler#4002
1d406ce
@winston winston added a commit to jollygoodcode/dasherize that referenced this issue Jan 25, 2016
@winston winston Dsiable spring until rails/spring#456 is fixed. 3d04da5
@winston winston added a commit to jollygoodcode/dasherize that referenced this issue Jan 25, 2016
@winston winston Dsiable spring until rails/spring#456 is fixed. d16d781
@winston winston added a commit to jollygoodcode/reread that referenced this issue Jan 26, 2016
@winston winston Disable spring until rails/spring#456 is fixed. f5b5e3e
@siruguri siruguri added a commit to siruguri/track_status that referenced this issue Jan 26, 2016
@siruguri siruguri Remove Spring to avoid issue 3ea6015
@notahat
notahat commented Jan 27, 2016

I have some steps to reproduce the problem reliably.

The key line in here is bundle install --path .bundle. The error seems to occur as soon as you use a non-default bundle path. If you skip that line, the error doesn't occur.

$ bundle --version
Bundler version 1.11.2

$ rails --version
Rails 4.2.5.1

$ rails new foo
...
Bundle complete! 12 Gemfile dependencies, 54 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

$ cd foo
$ bundle install --path .bundle
...
Bundle complete! 12 Gemfile dependencies, 54 gems now installed.
Bundled gems are installed into ./.bundle.

$ spring --version
Spring version 1.6.2

$ bundle exec rails console
/Users/notahat/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
    from /Users/notahat/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/commands.rb:33:in `<module:Spring>'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/commands.rb:4:in `<top (required)>'
    from /Users/notahat/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/notahat/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/application.rb:77:in `preload'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/application.rb:143:in `serve'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/application.rb:131:in `block in run'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/application.rb:125:in `loop'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/application.rb:125:in `run'
    from /Users/notahat/Desktop/foo/.bundle/ruby/2.2.0/gems/spring-1.6.2/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/notahat/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/notahat/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
@turboladen

The error seems to occur as soon as you use a non-default bundle path.

That's not 100% true, @notahat. I use vendor/bundle for my bundle path and 1.6.2 fixed things for me. I do, however, run into the same problem you described when creating a new app.

@cknoxrun

Interesing, @turboladen, I also use vendor/bundle and 1.6.2 did not fix things for me. Here is my .bundle/config:

---
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_PATH: vendor

I still get the same error as @notahat.

@jonleighton
Member

Ok, I'm trying to wrap my head around what's going on here. Here are some notes, mainly for my own benefit:

  • When Bundler loads, it needs to ensure that all child Ruby processes will operate "within" the bundle. Therefore it sets some environment variables that Ruby will use when it runs.
  • Environment variables which it sets include:
    • RUBYOPT: which specifies command line options which should be automatically applied to the ruby process
    • RUBYLIB: which specifies paths which should be added to the $LOAD_PATH within the ruby process
  • To ensure that child ruby processes operate within the bundle, bundler adds -rbundler/setup to RUBYOPT
  • To ensure that -rbundler/setup works, the bundler source needs to be in the $LOAD_PATH. Bundler used to achieve this by also adding -I[path] to RUBYOPT, but that caused some problems with spaces in path names. Therefore in bundler/bundler#2536 it switched to adding the path to RUBYLIB. This was released in Bundler version 1.5.0 (i.e. a long time ago).
  • Bundle.with_clean_env is meant to clean the environment in order to "unload" bundler, so that you can launch child processes without them operating within the bundle.
  • However, there was a bug where Bundle.with_clean_env did not properly clean the RUBYLIB environment variable. That was fixed and the fix was released in Bundler version 1.11 (i.e. quite recently)
  • We use Bundle.with_clean_env here, when launching the long-running Rails environments which spring uses to run commands. We do it so that the Rails processes can be launched in a different Bundler environment than the Spring server process which enables Spring to restart your Rails processes even when the Gemfile changes.
  • When we preload Rails inside the long-running Spring process, we require spring/commands, which in turn requires bundler
  • Before Bundler 1.11, that worked because the RUBYLIB was guaranteed to contain the path to the bundler source, since Bundle.with_clean_env didn't remove it.
  • After Bundle 1.11, there may now be cases where RUBYLIB doesn't contain the path to the bundler source, and therefore the require fails, as reported in this bug.
  • Therefore we need to make sure we set RUBYLIB such that bundler can be found after calling Bundle.with_clean_env, since the "correct" behaviour of Bundle.with_clean_env is to remove bundler from that environment variable.
@turboladen

Just to follow up for @cknoxrun , here's a local .bunde/config for an app that's working for me:

---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_WITHOUT: production

And for giggles, some ENV vars with "ruby" in them, in case that's of any help:

twilight git:develop ❯ env | sift -i ruby
PATH=/Users/sloveless/.gem/ruby/2.3.0/bin:/Users/sloveless/.rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/bin:/Users/sloveless/.rubies/ruby-2.3.0/bin:/usr/local/heroku/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin:/usr/local/heroku/bin:/usr/local/sbin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/sloveless/Development/projects/config_files/tmux:/usr/local/share/npm/bin:/usr/local/opt/fzf/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin:/Users/sloveless/Development/projects/config_files/tmux:/usr/local/share/npm/bin
RUBY_ROOT=/Users/sloveless/.rubies/ruby-2.3.0
RUBYOPT=
RUBY_ENGINE=ruby
RUBY_VERSION=2.3.0
GEM_ROOT=/Users/sloveless/.rubies/ruby-2.3.0/lib/ruby/gems/2.3.0
GEM_HOME=/Users/sloveless/.gem/ruby/2.3.0
GEM_PATH=/Users/sloveless/.gem/ruby/2.3.0:/Users/sloveless/.rubies/ruby-2.3.0/lib/ruby/gems/2.3.0

Again, I'm using chruby and wonder if that plays into any variables here.

@jonleighton
Member

Yes, I think it's highly likely your env is what shields you from this issue. (I'm trying to write a test and finding that the env needs to be just right in order to repro...)

@jonleighton jonleighton added a commit that referenced this issue Jan 30, 2016
@jonleighton jonleighton Specify path which we'll load bundler from
Fixes #456. See my analysis at
#456 (comment)

Previously we were implicitly relying on Bundler setting RUBYLIB so that
we'd be able to find Bundler in the child process.

Bundler 1.11 no longer does that for us, so we need to explicitly do it
ourselves (it was a bug that Bundle.with_clean_env didn't clear it).
761d3ac
@jonleighton jonleighton added a commit that referenced this issue Jan 30, 2016
@jonleighton jonleighton Specify path which we'll load bundler from
Fixes #456. See my analysis at
#456 (comment)

Previously we were implicitly relying on Bundler setting RUBYLIB so that
we'd be able to find Bundler in the child process.

Bundler 1.11 no longer does that for us, so we need to explicitly do it
ourselves (it was a bug that Bundle.with_clean_env didn't clear it).
95ee849
@jonleighton jonleighton added a commit that referenced this issue Feb 1, 2016
@jonleighton jonleighton Specify path which we'll load bundler from
Fixes #456. See my analysis at
#456 (comment)

Previously we were implicitly relying on Bundler setting RUBYLIB so that
we'd be able to find Bundler in the child process.

Bundler 1.11 no longer does that for us, so we need to explicitly do it
ourselves (it was a bug that Bundle.with_clean_env didn't clear it).
115d247
@jonleighton jonleighton added a commit that referenced this issue Feb 4, 2016
@jonleighton jonleighton Specify path which we'll load bundler from
Fixes #456. See my analysis at
#456 (comment)

Previously we were implicitly relying on Bundler setting RUBYLIB so that
we'd be able to find Bundler in the child process.

Bundler 1.11 no longer does that for us, so we need to explicitly do it
ourselves (it was a bug that Bundle.with_clean_env didn't clear it).
390e98f
@jonleighton jonleighton added a commit that closed this issue Feb 4, 2016
@jonleighton jonleighton Specify path which we'll load bundler from
Fixes #456. See my analysis at
#456 (comment)

Previously we were implicitly relying on Bundler setting RUBYLIB so that
we'd be able to find Bundler in the child process.

Bundler 1.11 no longer does that for us, so we need to explicitly do it
ourselves (it was a bug that Bundle.with_clean_env didn't clear it).
cee61e3
@jonleighton
Member

After a drawn-out battle getting the CI to work, 1.6.3 is now out. It should fix this bug. Please try it.

@grosser
Collaborator
grosser commented Feb 4, 2016

thx for your work on that, those are some nasty issues! ❀️

@cknoxrun
cknoxrun commented Feb 4, 2016

Thank you!! It works!

@turboladen

1.6.3 works for me (1.6.2 did too)!

@freswa
freswa commented Feb 6, 2016

Thanks! Also works for me πŸ‘

@KazuyaHara

It works for me, too. Thanks!

@codeanpeace

Updating to 1.6.3 fixed it for me as well - thanks!

@fedemoretti

I'm running a new Rails project using rails new foo, with this gems versions:
Ruby: 2.3.0p7
Rails: 4.2.5.1
Bundler: 1.11.2
Spring: 1.6.3

But when I try to run rails command inside the project I get:

/Users/fefo/.rvm/rubies/ruby-2.3-head/lib/ruby/site_ruby/2.3.0/rubygems/path_support.rb:50:in `split_gem_path': undefined method `split' for #<Array:0x007fcb4aba5780> (NoMethodError)
    from /Users/fefo/.rvm/rubies/ruby-2.3-head/lib/ruby/site_ruby/2.3.0/rubygems/path_support.rb:32:in `initialize'
    from /Users/fefo/.rvm/rubies/ruby-2.3-head/lib/ruby/site_ruby/2.3.0/rubygems.rb:346:in `new'
    from /Users/fefo/.rvm/rubies/ruby-2.3-head/lib/ruby/site_ruby/2.3.0/rubygems.rb:346:in `paths='
    from /Users/fefo/Projects/web/foo/bin/spring:11:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

I even get it trying to do rails -v

My bin/spring file looks like this:

#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
  require 'rubygems'
  require 'bundler'

  if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^    (?:  )*spring \((.*?)\)$.*?^$/m))
    Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq }
    gem 'spring', match[1]
    require 'spring/binstub'
  end
end

It's not the same error as described in this issue but I thought it might be related. In other case I can open a separate issue.

Any help would be appreciated,
Thanks,

@fedemoretti

I did a little bit of investigation and I found Gem.path has two paths:

/Users/fefo/.rvm/gems/ruby-2.3-head@rails4
/Users/fefo/.rvm/gems/ruby-2.3-head@global

It seems that I have GEM_PATH env variable set to:

/Users/fefo/.rvm/gems/ruby-2.3-head@rails4:/Users/fefo/.rvm/gems/ruby-2.3-head@global

Should I change this to have only one gemset? I actually don't know why I have both global and rails4 set.

@jhenahan

Hey, I hit this issue, too, and regenerating binstubs with

bundle exec spring binstub --all

seems to have fixed it.

@therebelrobot therebelrobot referenced this issue in spiffysparrow/Poemist Apr 21, 2016
Open

Docs: Install and usage #13

@mislav mislav added a commit to mislav/trackobot.com that referenced this issue Jun 23, 2016
@mislav mislav Upgrade Spring to fix `rails console` for Bundler 1.11 6e6e591
@MatayoshiMariano

Updating Rails binaries worked for me bundle exec rake rails:update:bin

@suer suer added a commit to codefirst/vertex that referenced this issue Nov 11, 2016
@suer suer Updated: spring to exec rails c 1c379e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment