在使用Whenever和Capistrano时,无法在任何来源中找到rake 10.0.3

时间:2013-01-09 22:57:20

标签: ruby-on-rails rake capistrano bundler whenever

我正试图在3.2.8上使用我的Rails应用程序上的Captainrano随时使用gem,使用RVM和该Rails版本的gemset。

我收到以下错误:在任何来源中找不到rake-10.0.3(Bundler :: GemNotFound)

这是错误的输出(我记录在文件上):

/home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find rake-10.0.3 in any of the sources (Bundler::GemNotFound)
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `map!'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `materialize'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/definition.rb:113:in `specs'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/definition.rb:158:in `specs_for'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/definition.rb:147:in `requested_specs'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/environment.rb:23:in `requested_specs'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:11:in `setup'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler.rb:116:in `setup'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/setup.rb:17:in `<top (required)>'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /home/some_user/some_user/config/boot.rb:6:in `<top (required)>'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from script/rails:5:in `<main>'

我在使用Rake 10.0.2时也遇到了错误(我做了捆绑更新并获得了Rake 10.0.3,我将其留待测试)。此外,我注意到捆绑器正在搜索@global,我认为它应该搜索gemset(称为@ r328,位于/home/some_user/.rvm/gems)。

.rvmrc(位于项目内部)

source ~/.profile
rvm use 1.9.3@r328
rvm_trust_rvmrcs_flag=1

的.profile

if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

schedule.rb(用于测试)

set :output, "#{path}/log/cron.log"

every 1.minute do
  runner "MenuOrder.send_resume(2)"
end

deploy.rb

set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"

宝石列表的输出

actionmailer (3.2.8)
actionpack (3.2.8)
active_utils (1.0.5)
activeadmin (0.5.0)
activemerchant (1.29.3, 1.28.0)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
arbre (1.0.1)
arel (3.0.2)
authorize-net (1.5.2)
bcrypt-ruby (3.0.1)
bourbon (3.0.1, 2.1.2, 2.1.1)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.13.5)
carrierwave (0.8.0, 0.7.1, 0.7.0)
chronic (0.9.0)
cocaine (0.4.2)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
daemon_controller (1.1.0)
daemons (1.1.9)
delayed_job (3.0.4)
delayed_job_active_record (0.3.3)
devise (2.2.0, 2.1.2)
erubis (2.7.0)
execjs (1.4.0)
fastercsv (1.5.5)
fastthread (1.0.7)
formtastic (2.2.1)
has_scope (0.5.1)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1)
inherited_resources (1.3.1)
journey (1.0.4)
jquery-rails (2.1.4, 2.1.3)
json (1.7.6, 1.7.5)
kaminari (0.14.1)
mail (2.4.4)
meta_search (1.1.3)
mime-types (1.19)
money (5.1.0)
multi_json (1.5.0, 1.3.7, 1.3.6)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.2)
net-ssh-gateway (1.1.0)
nokogiri (1.5.6, 1.5.5)
orm_adapter (0.4.0)
paperclip (3.4.0, 3.3.1)
passenger (3.9.1.beta, 3.0.19, 3.0.18)
polyamorous (0.5.0)
polyglot (0.3.3)
rack (1.4.3, 1.4.1)
rack-cache (1.2)
rack-raw-upload (1.1.1, 1.1.0)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (10.0.3, 10.0.2, 0.9.2.2)
rdoc (3.12)
recaptcha (0.3.4)
responders (0.9.3)
rich (1.4.1, 1.3.1)
rmagick (2.13.1)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.5, 3.2.3, 3.2.1)
sass-rails (3.2.5)
sprockets (2.1.3)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35, 0.3.34)
uglifier (1.3.0)
warden (1.2.1)
whenever (0.8.1)

我尝试使用bundle更新,删除Gemfile.lock并进行bundle install,卸载所有rake gem(10.0.3和10.0.2)并使用bundle install安装gem但没有任何工作。

5 个答案:

答案 0 :(得分:10)

您可以使用

bundle install --path vendor/cache

希望这对你有所帮助。

答案 1 :(得分:3)

我为解决问题所做的工作有点棘手:

  1. 删除所有版本的Rake
  2. 删除Gemfile.lock
  3. 运行捆绑安装
  4. 使用以下方法手动安装Rake:gem install rake --version = 10.0.2
  5. 现在它正在工作,但由于某种原因它不会写日志文件。我会解决它并发布更新。

答案 2 :(得分:2)

只有一个bundle install为我工作。我认为这是因为我更新了Ruby但后来又忘了运行打包器。

答案 3 :(得分:0)

这就是你在运行rake任务时或者你在使用cron设置rake任务时遇到的错误?如果你认为它是无论什么宝石,我知道有很多关于什么时候不工作的讨论,因为Capistrano实际上改变了一些内部并且他们一直在慢慢修复它们,但他们还没有发布宝石的更新。 / p>

搜索他们的问题并查看您是否能找到与您相关的内容:

https://github.com/javan/whenever/issues

答案 4 :(得分:0)

此问题实际上是由于 BUNDLE_PATH 覆盖rvm gemset设置并在运行捆绑安装时将下载的文件存储在其他位置。要解决此问题,您可以删除.bundle文件夹或从.bundle / config中删除 BUNDLE_PATH 行。只需重新运行捆绑安装一次就可以了,你应该好好去!