Search code examples
ruby-on-railsrubyruby-on-rails-3rubygemsruby-on-rails-3.1

Error while executing bundle exec


I get this error while running bundle exec

/usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/cli.rb:344:in `exec': wrong number of arguments (ArgumentError)
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/cli.rb:344:in `exec'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/vendor/thor/task.rb:22:in `send'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/vendor/thor/base.rb:386:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19

line of code inside usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/cli.rb ~344 has been given as follows. Seems like there's some argument its seeking for!!!

 def exec(*)
  ARGV.shift # remove "exec"

  Bundler.setup

  begin
    # Run
    Kernel.exec(*ARGV)
  rescue Errno::EACCES
    Bundler.ui.error "bundler: not executable: #{ARGV.first}"
    exit 126
  rescue Errno::ENOENT
    Bundler.ui.error "bundler: command not found: #{ARGV.first}"
    Bundler.ui.warn  "Install missing gem executables with `bundle install`"
    exit 127
  end
end

desc "config NAME [VALUE]", "retrieve or set a configuration value"
long_desc <<-D
  Retrieves or sets a configuration value. If only parameter is provided, retrieve the value. If two parameters are provided, replace the
  existing value with the newly provided one.

  By default, setting a configuration value sets it for all projects
  on the machine.

  If a global setting is superceded by local configuration, this command
  will show the current value, as well as any superceded values and
  where they were specified.
D

Solution

  • If you're just running a naked bundle exec with no other parameters, the line:

    Kernel.exec(*ARGV)
    

    is not going to have enough information to execute anything. You need to provide a command to your bundle exec as shown here.