Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn about bundler/setup failure #275

Merged
merged 1 commit into from May 31, 2019

Conversation

Projects
None yet
1 participant
@tongueroo
Copy link
Owner

commented May 31, 2019

This is a 馃悶 bug fix.

  • I've added tests (if it's a bug, feature or enhancement)
  • I've adjusted the documentation (if it's a feature or enhancement)
  • The test suite passes (run bundle exec rspec to verify this)

Summary

On some systems, there's a ruby and bundler issue where require "bundler/setup" throws an error. Think this may be because bundler.rb exists at 2 places. Found them here on my system:

$ find /home/ec2-user/.rbenv/versions/2.5.3/ -name bundler.rb
/home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler.rb
/home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/bundler.rb
$ 

When the site_ruby/2.5.0/bundler.rb is older or does not have bundler/setup.rb it will cause an LoadError. This was reported in the community forums. Removing site_ruby/2.5.0/bundler/setup.rb mimics the error:

$ jets server
Traceback (most recent call last):
        13: from /home/ec2-user/.rbenv/versions/2.5.3/bin/jets:23:in `<main>'
        12: from /home/ec2-user/.rbenv/versions/2.5.3/bin/jets:23:in `load'
        11: from /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/exe/jets:13:in `<top (required)>'
        10: from /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         9: from /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         8: from /home/ec2-user/.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 /home/ec2-user/.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 /home/ec2-user/.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 /home/ec2-user/.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 /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         3: from /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
         2: from /home/ec2-user/.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 /home/ec2-user/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/jets-1.9.8/lib/jets/bundle.rb:19:in `setup'
/home/ec2-user/.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)

Calling commands with bundle exec will work though.

$ bundle exec jets server                                                 
=> bundle exec rackup --port 8888 --host 127.0.0.1
Jets booting up in development mode!
[2019-05-31 04:44:18] INFO  WEBrick 1.4.2
[2019-05-31 04:44:18] INFO  ruby 2.5.3 (2018-10-18) [x86_64-linux]
[2019-05-31 04:44:18] INFO  WEBrick::HTTPServer#start: pid=1124 port=8888

Think bundle exec will adjust the $LOAD_PATH early enough so that the bundler in the gems path not the site_ruby path is required first.

Solution

The workaround solution right now is to print a warning message to the user and suggest fixing their ruby and bundler installation. Here's what the fix looks like:

$ jets server                                                 
cannot load such file -- bundler/setup
WARNING: Unable to require "bundler/setup"
There may be something funny with your ruby and bundler setup.
You can try upgrading bundler and rubygems:

    gem update --system
    gem install bundler

Here are some links that may be helpful:

* https://bundler.io/blog/2019/01/03/announcing-bundler-2.html
* https://community.rubyonjets.com/t/jets-1-9-8-install-issue-bundler-setup-missing/185/2

Also, running bundle exec in front of your command may remove this message.

=> bundle exec rackup --port 8888 --host 127.0.0.1
Jets booting up in development mode!
[2019-05-31 04:48:47] INFO  WEBrick 1.4.2
[2019-05-31 04:48:47] INFO  ruby 2.5.3 (2018-10-18) [x86_64-linux]
[2019-05-31 04:48:47] INFO  WEBrick::HTTPServer#start: pid=1730 port=8888

Context

https://community.rubyonjets.com/t/jets-1-9-8-install-issue-bundler-setup-missing/185/3

Version Changes

@tongueroo tongueroo merged commit 4f37bba into master May 31, 2019

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@tongueroo tongueroo deleted the bundle-require-warn branch May 31, 2019

@tongueroo tongueroo referenced this pull request Jun 6, 2019

Closed

NameError: uninitialized constant no controllers #281

2 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.