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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bundler: failed to load command: bin/rails (bin/rails) #732
Comments
Meet same problem. However, it works if I copy the command and run it in the terminal. |
Same here! Whenever is generating a cronjob like "... && bundle exec bin/rails..." instead of "... && bundle exec rails..." As a workaround I'm rewriting the default runner command: # In the beginning of your schedule.rb file
set :bundle_command, 'bundle exec'
job_type :runner, "cd :path && :bundle_command rails runner -e :environment ':task' :output" |
Hi, Any update regarding this issue |
Hi, have same issue. my schedule.rb set :chronic_options, hours24: true
set :environment, ENV['RAILS_ENV']
set :output, "#{path}/log/cron.log"
set :bundle_command, 'bundle exec'
job_type :runner, "cd :path && :bundle_command rails runner -e :environment ':task' :output"
every 1.minute do
runner 'Remote::PostsSchedulerJob.perform_later'
end Generated command: /bin/bash -l -c 'cd /Users/svr/Documents/Projects/**private**/backend && bundle exec rails runner -e production '\''Remote::PostsSchedulerJob.perform_later'\'' >> /Users/svr/Documents/Projects/**private**/backend/log/cron.log 2>&1' When running in ssh console - it works bundler: command not found: rails
Install missing gem executables with `bundle install` Why? |
I see this error, too, except "GemNotFound: Could not find i18n-1.7.0 is any of the sources". |
i've spent the past 3 days trying to find a fix for this, another vote for someone with this issue. I can copy and past the cron command manually into the terminal and it works fine but on cron itself can't seem to run it. Cron is being run by the same user. schedule.rb env :GEM_PATH, '/usr/local/bundle'
env :PATH, '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
set :output, {:error => 'delayed_newsletter_error.log', :standard => 'delayed_newsletter_standard.log'}
every 2.minute do
runner "Fundraisings::DelayedNewsletterSignUpProcessor.call"
end |
Hi, any update regarding this issue? |
@gorodscy your solutions did not work for me. Still getting same error. Well, I've set up a lot of servers with same app all are using cron job to run jobs, yesterday I set up new servers this time cron job is not working. here are the logs before adding your fix /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in block in require'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in load_dependency' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in require'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:378:in block in require_or_load' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:37:in block in load_interlock'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:14:in block in loading' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/concurrency/share_lock.rb:151:in exclusive'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:13:in loading' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:37:in load_interlock'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:356:in require_or_load' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:334:in depend_on'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:246:in require_dependency' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:478:in block (2 levels) in eager_load!'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:477:in each' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:477:in block in eager_load!'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:475:in each' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:475:in eager_load!'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:356:in eager_load!' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application/finisher.rb:69:in each'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application/finisher.rb:69:in block in <module:Finisher>' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:32:in instance_exec'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:32:in run' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:61:in block in run_initializers'/usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:228:in block in tsort_each' /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'/usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:431:in each_strongly_connected_component_from' /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:349:in block in each_strongly_connected_component'/usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:347:in each' /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:347:in call'/usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:347:in each_strongly_connected_component' /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:226:in tsort_each'/usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:205:in tsort_each' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:60:in run_initializers'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application.rb:361:in initialize!' /home/ubuntu/www/sites/app/config/environment.rb:5:in '/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in block in require'/usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in load_dependency' /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in require'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application.rb:337:in require_environment!' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command/actions.rb:28:in require_environment!'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command/actions.rb:15:in require_application_and_environment!' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/commands/runner/runner_command.rb:29:in perform'/usr/local/rvm/gems/ruby-2.4.4/gems/thor-1.1.0/lib/thor/command.rb:27:in run' /usr/local/rvm/gems/ruby-2.4.4/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command'/usr/local/rvm/gems/ruby-2.4.4/gems/thor-1.1.0/lib/thor.rb:392:in dispatch' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command/base.rb:69:in perform'/usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command.rb:46:in invoke' /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/commands.rb:18:in '/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'/usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' bin/rails:4:in <top (required)>'` agter adding your fix from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in block in require'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in load_dependency' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in require'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:378:in block in require_or_load' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:37:in block in load_interlock'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:14:in block in loading' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/concurrency/share_lock.rb:151:in exclusive'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:13:in loading' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:37:in load_interlock'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:356:in require_or_load' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:334:in depend_on'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:246:in require_dependency' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:478:in block (2 levels) in eager_load!'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:477:in each' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:477:in block in eager_load!'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:475:in each' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:475:in eager_load!'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/engine.rb:356:in eager_load!' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application/finisher.rb:69:in each'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application/finisher.rb:69:in block in <module:Finisher>' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:32:in instance_exec'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:32:in run' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:61:in block in run_initializers'from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:228:in block in tsort_each' from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:431:in each_strongly_connected_component_from' from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:349:in block in each_strongly_connected_component'from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:347:in each' from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:347:in call'from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:347:in each_strongly_connected_component' from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:226:in tsort_each'from /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/tsort.rb:205:in tsort_each' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/initializable.rb:60:in run_initializers'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application.rb:361:in initialize!' from /home/ubuntu/www/sites/app/config/environment.rb:5:in 'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in block in require'from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in load_dependency' from /usr/local/rvm/gems/ruby-2.4.4/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in require'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/application.rb:337:in require_environment!' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command/actions.rb:28:in require_environment!'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command/actions.rb:15:in require_application_and_environment!' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/commands/runner/runner_command.rb:29:in perform'from /usr/local/rvm/gems/ruby-2.4.4/gems/thor-1.1.0/lib/thor/command.rb:27:in run' from /usr/local/rvm/gems/ruby-2.4.4/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command'from /usr/local/rvm/gems/ruby-2.4.4/gems/thor-1.1.0/lib/thor.rb:392:in dispatch' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command/base.rb:69:in perform'from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/command.rb:46:in invoke' from /usr/local/rvm/gems/ruby-2.4.4/gems/railties-5.2.6/lib/rails/commands.rb:18:in 'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /usr/local/rvm/gems/ruby-2.4.4/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from bin/rails:4:in '`
|
Just to bump this a bit more as having the same issue running 2.7.4 in production environment /home/rails/xxxxx/shared/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/application.rb:585:in |
Mine wasn't working until I added the instruction set :output, "/home/cron_log.log"
set :bundle_command, 'bundle exec'
env :GEM_PATH, ENV['GEM_PATH']
env :GEM_HOME, ENV['GEM_HOME']
job_type :runner, "cd :path && :bundle_command rails runner -e :environment ':task' :output"
every 1.minute do
runner 'SomeJob.perform_now'
end |
I know this issue is closed, but I had this same warning because I'm using zsh and asdf and I ended up here. The task was failing because of a mismatched ruby version and asdf not being loaded in the cron environment. Ultimately this is what I used to run a rake task with my zsh/asdf settings:
|
Please help to solve this error
-- config/schedule.rb
set :output, "#{path}/log/trending_new.log"
every 5.minute do
runner "Video.some_task_new('title')"
end
-- models/video.rb
def self.some_task_new(field)
Video.pluck(field).each { |e| puts e }
end
-- log/trending_new.log
New Testing......
bundler: failed to load command: bin/rails (bin/rails)
Bundler::GemNotFound: Could not find nokogiri-1.8.0 in any of the sources
/home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/spec_set.rb:87:in
block in materialize' /home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/spec_set.rb:80:in
map!'/home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/spec_set.rb:80:in
materialize' /home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/definition.rb:176:in
specs'/home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/definition.rb:235:in
specs_for' /home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/definition.rb:224:in
requested_specs'/home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:118:in
block in definition_method' /home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:19:in
setup'/home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler.rb:100:in
setup' /home/wscube/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/setup.rb:20:in
<top (required)>'/home/wscube/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require' /home/wscube/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require'The text was updated successfully, but these errors were encountered: