`bundle exec` option not used

Answered


I have a project I'm using Sidekiq with and my gem command run configuration has the box checked in the run dialog to execute the command in the context of the bundle, but this does not happen.  See this output:

bash -c ". /usr/local/share/chruby/chruby.sh && chruby ruby-2.5.1 && /home/rpc/.rubies/ruby-2.5.1/bin/ruby /home/rpc/.gem/ruby/2.5.1/bin/sidekiq"
WARN: Unresolved specs during Gem::Specification.reset:
      minitest (~> 5.1)
      rack-test (>= 0.6.3)
      nokogiri (>= 1.6)
      builder (~> 3.1)
      loofah (>= 2.2.2, ~> 2.2)
      rake (>= 0.8.7)
      thor (< 2.0, >= 0.19.0)
      method_source (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Traceback (most recent call last):
    21: from /home/rpc/.gem/ruby/2.5.1/bin/sidekiq:23:in `<main>'
    20: from /home/rpc/.gem/ruby/2.5.1/bin/sidekiq:23:in `load'
    19: from /home/rpc/.gem/ruby/2.5.1/gems/sidekiq-5.2.1/bin/sidekiq:12:in `<top (required)>'
    18: from /home/rpc/.gem/ruby/2.5.1/gems/sidekiq-5.2.1/lib/sidekiq/cli.rb:53:in `run'
    17: from /home/rpc/.gem/ruby/2.5.1/gems/sidekiq-5.2.1/lib/sidekiq/cli.rb:278:in `boot_system'
    16: from /home/rpc/.rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:122:in `require'
    15: from /home/rpc/.rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:122:in `require'
    14: from /home/rpc/Projects/Rails/think_tsi/config/environment.rb:2:in `<top (required)>'
    13: from /home/rpc/Projects/Rails/think_tsi/config/environment.rb:2:in `require_relative'
    12: from /home/rpc/Projects/Rails/think_tsi/config/application.rb:1:in `<top (required)>'
    11: from /home/rpc/Projects/Rails/think_tsi/config/application.rb:1:in `require_relative'
    10: from /home/rpc/Projects/Rails/think_tsi/config/boot.rb:3:in `<top (required)>'
     9: from /home/rpc/.rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:122:in `require'
     8: from /home/rpc/.rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:122:in `require'
     7: from /home/rpc/.gem/ruby/2.5.1/gems/bundler-1.16.5/lib/bundler/setup.rb:10:in `<top (required)>'
     6: from /home/rpc/.gem/ruby/2.5.1/gems/bundler-1.16.5/lib/bundler.rb:107:in `setup'
     5: from /home/rpc/.gem/ruby/2.5.1/gems/bundler-1.16.5/lib/bundler/runtime.rb:26:in `setup'
     4: from /home/rpc/.gem/ruby/2.5.1/gems/bundler-1.16.5/lib/bundler/runtime.rb:26:in `map'
     3: from /home/rpc/.rubies/ruby-2.5.1/lib/ruby/2.5.0/forwardable.rb:229:in `each'
     2: from /home/rpc/.rubies/ruby-2.5.1/lib/ruby/2.5.0/forwardable.rb:229:in `each'
     1: from /home/rpc/.gem/ruby/2.5.1/gems/bundler-1.16.5/lib/bundler/runtime.rb:31:in `block in setup'
/home/rpc/.gem/ruby/2.5.1/gems/bundler-1.16.5/lib/bundler/runtime.rb:313:in `check_for_activated_spec!': You have already activated activesupport 5.2.1.1, but your Gemfile requires activesupport 5.2.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

Process finished with exit code 1

I can run this in a console with `bundle exec sidekiq` and it runs as expected.

Using:

RubyMine 2018.2.4
Build #RM-182.4505.55, built on October 8, 2018
Licensed to <name>
Subscription is active until <active date>
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-42-generic

 

11 comments
Comment actions Permalink

Hello Robert,

could you please check how it goes in RubyMine 2018.3.1 EAP?

0
Comment actions Permalink

I'm having exactly the same problem. None of my run commands are getting run with bundler. I'm on 2019.2.4

0
Comment actions Permalink

Filip Kis, could you please provide more details about the problem you have?

0
Comment actions Permalink

Olga Kuvardina I noticed the same issue --

Checking the `Run script in the context of bundle` is not changing the run parameters.

 

I am using:

IntelliJ IDEA 2019.3 (Ultimate Edition)
Build #IU-193.5233.102, built on November 27, 2019
Licensed to Looker / Farid Zakaria
Subscription is active until November 5, 2020
Runtime version: 11.0.4+10-b520.11 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: org.jetbrains.kotlin, org.jetbrains.plugins.slim, org.jetbrains.plugins.ruby

0
Comment actions Permalink

Farid, could you please check whether the option 'ruby.force.explicit.bundle.exec' is checked or not in Help - Find Action - Experimental Features?

0
Comment actions Permalink

Hi Olga, 

I had the option checked and tried also unchecking it, but my commands just never include `bundle exec` in their run parameters. 

0
Comment actions Permalink

Hi Olga Kuvardina

 

Having the same problem with Intellij 2020.1.1.  In my case I am trying to run minitest and the command never adds bundle exec even though the option is selected.  I also checked and 'ruby.force.explicit.bundle.exec' is checked in experimental features. 

0
Comment actions Permalink

Same issue on 2020.1.1 (it started with 2020.1 - previous versions worked fine). I'm using rbenv, if that provides any clues. The tests were never executed in the context of the bundle, even though the test configuration indicated they should be, and `ruby.force.explicit.bundle.exec` was enabled.

I was able to fix it by uninstalling my rbenv ruby and reinstalling. However, I'm not 100% sure that was the culprit, as I tried a few other things at the same time, such as uninstalling all of my system gems, performing a `gem update --system`, and invalidating my RubyMine caches.

Hope this helps someone - sorry I couldn't narrow it down further!

0
Comment actions Permalink

`gem update --system` resolved this for one of my team members, I would start there.

 

Olga Kuvardina, perhaps RubyMine could detect older rubygems versions and prompt the user to update?

0
Comment actions Permalink

I ran into this on 2020.2.1 after an update from 2019.2.4. Also a rbenv user.

`gem update --system` didn't work.

What did work was running the "bundler" action.

I got prompted about a Gemfile needing a non-existing version of bundler(weird, because it existed when I was on 2019.2.4). Anyways, I installed the recommended version, and suddenly things started working again.


2
Comment actions Permalink

Thanks, Gmcmonty . It was helpful.

 I just ran a bundler action `bundle install`. And after that, it started working fine.

0

Please sign in to leave a comment.