Jets 1.9.8 issue cannot load such file bundler/setup (LoadError)


#1

Is anyone else having an issue with 1.9.8?
I tried to create a brand new project and hit a snag:

jets new demo -> works
cd demo
jets generate scaffold post title:string

	13: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/bin/jets:23:in `<main>'
	12: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/bin/jets:23:in `load'
	11: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/exe/jets:13:in `<top (required)>'
	10: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 9: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 8: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/lib/jets.rb:13:in `<top (required)>'
	 7: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
	 6: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
	 5: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
	 4: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 3: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 2: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/lib/jets/autoloaders.rb:2:in `<top (required)>'
	 1: from /Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/lib/jets/bundle.rb:19:in `setup'
/Users/thusharawijeratna/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/lib/jets/bundle.rb:19:in `require': cannot load such file -- bundler/setup (LoadError)

#2

Interesting. This might be a ruby + bundler bug depending on the version of ruby

Tried to use the version of ruby in the issue 6465 and bundler version also, but was not able to reproduce:

$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
$ irb
>> require "bundler"
=> true
>> require "bundler/setup"
=> true
>> Bundler::VERSION
=> "1.16.1"
>> 
$ 

This comment from the bundler github issue may help:

So after some debugging I’ve found that default rvm’s ruby-2.5.0 installation has bundled /home/ojab/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/bundler{,.rb} and missing files (i. e. bundler/ui ) are required from there instead of installed gem.
Since ruby converts $LOAD_PATH entries to realpaths, the issue is not reproducible in that case.
rvm’s ruby-2.5.1 doesn’t install that bundler{,.rb} , so the issue is reproducible there.

So it looks like on some installs of ruby it installs it’s own version of bundler.rb and that version in the ruby stdlib is missing bundler/setup. It could have been fixed in different ruby patch versions or later by the installer…

Overall. Unsure. Would like to know if you end up resolving it. This could be specific to system setup. :thinking:


#3

Somewhat a shot in the dark here. But thought about this and was able to mimic the error by removing bundler/setup.rb from the site_ruby install of bundler. Apparently, there are 2 installs of bundler and seems like sometimes the site_ruby ruby install could be different or broken or old. Found some clues here: https://github.com/Shopify/bootsnap/issues/134 and various google searches.

Released this “workaround fix” https://github.com/tongueroo/jets/pull/275 in v1.9.9 Ultimately, think this may be a system/ruby/bundler issue.


#4

Yes, bundler exec finds the right gems - thanks!