生产中没有安装Rails宝石(无论何时)

时间:2015-05-13 11:32:30

标签: ruby-on-rails ruby-on-rails-4 whenever whenever-capistrano

我正在部署带有capistrano的rails应用程序,但会收到错误,无论何时未安装

DEBUG [36f4c99a]    bundler: command not found: whenever
DEBUG [36f4c99a]    Install missing gem executables with `bundle install`
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@xxx.xx.xx.xxx: bundle exit status: 127
bundle stdout: bundler: command not found: whenever
Install missing gem executables with `bundle install`
bundle stderr: Nothing written
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
SSHKit::Command::Failed: bundle exit status: 127
bundle stdout: bundler: command not found: whenever
Install missing gem executables with `bundle install`
bundle stderr: Nothing written
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/command.rb:95:in `exit_status='
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:179:in `block in _execute'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/whenever-0.9.4/lib/whenever/tasks/whenever.rake:9:in `block (3 levels) in setup_whenever_task'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/abstract.rb:85:in `with'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/whenever-0.9.4/lib/whenever/tasks/whenever.rake:8:in `block (2 levels) in setup_whenever_task'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/abstract.rb:77:in `within'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/whenever-0.9.4/lib/whenever/tasks/whenever.rake:7:in `block in setup_whenever_task'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/batman/.rvm/gems/ruby-2.2.0/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => whenever:update_crontab
(See full trace by running task with --trace)

如果我在服务器上手动安装gem,那么我会再次发现另一个缺少的gem错误......

/home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/spec_set.rb:92:in `block in materialize'
DEBUG [98da4528]    :
DEBUG [98da4528]    Could not find i18n-0.7.0 in any of the sources
DEBUG [98da4528]     (
DEBUG [98da4528]    Bundler::GemNotFound
DEBUG [98da4528]    )
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/spec_set.rb:85:in `map!'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/spec_set.rb:85:in `materialize'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/definition.rb:132:in `specs'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/definition.rb:177:in `specs_for'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/definition.rb:166:in `requested_specs'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/environment.rb:18:in `requested_specs'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:13:in `setup'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler.rb:122:in `setup'
DEBUG [98da4528]        from /home/deploy/.rvm/gems/ruby-2.2.0/gems/bundler-1.9.7/lib/bundler/setup.rb:18:in `<top (required)>'
DEBUG [98da4528]        from /home/deploy/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
DEBUG [98da4528]        from /home/deploy/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
cap aborted!

我的Gemfile

source 'https://rubygems.org'
ruby '2.2.0'
gem 'rails', '4.2.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'whenever', :require => false
group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
end
gem 'bootstrap-sass'
gem 'devise'
gem 'slim-rails'
# gem 'pg'
gem 'pg','0.18.1'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller', :platforms=>[:mri_21]
  gem 'capistrano', '~> 3.0.1'
  gem 'capistrano-bundler'
  gem 'capistrano-rails', '~> 1.1.0'
  gem 'capistrano-rails-console'
  gem 'capistrano-rvm', '~> 0.1.1'
  gem 'quiet_assets'
  gem 'rails_layout'
  gem 'spring-commands-rspec'
end
group :development, :test do
  gem 'factory_girl_rails'
  gem 'faker'
  gem 'puma'
  gem 'rspec-rails'
end
group :test do
  gem 'capybara'
  gem 'database_cleaner'
  gem 'launchy'
  gem 'selenium-webdriver'
end

1 个答案:

答案 0 :(得分:0)

对我而言,似乎没有添加

require 'capistrano/bundler'

到您的Capfile。这将在部署时安装所有宝石。