2013-01-09 35 views
4

我試圖使用gem每當Capistrano在3.2.8上的Rails應用程序中,使用RVM和gemset Rails版本。找不到耙10.0.3在任何來源時,使用Whenever和Capistrano時

,我發現了以下錯誤:不能在任何的來源找到耙10.0.3(捆紮機:: GemNotFound)

這是錯誤的輸出(這是我駕駛過一個文件):

/home/some_user/.rvm/gems/[email protected]/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/[email protected]/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `map!' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `materialize' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/definition.rb:113:in `specs' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/definition.rb:158:in `specs_for' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/definition.rb:147:in `requested_specs' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/environment.rb:23:in `requested_specs' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:11:in `setup' 
    from /home/some_user/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler.rb:116:in `setup' 
    from /home/some_user/.rvm/gems/[email protected]/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>' 

當我使用耙10.0.2我也得到了錯誤(我做捆綁更新並獲得耙10.0.3,我把它用於測試)。另外,我注意到,當我認爲它應該搜索gemset(名爲@ r328,位於/home/some_user/.rvm/gems)時,捆綁器正在@global上進行搜索。

.rvmrc(位於項目內)

source ~/.profile 
rvm use [email protected] 
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) 

我試圖捆綁更新,刪除Gemfile.lock的製作和安裝包,卸載所有的耙寶石(10.0.3和10.0.2),再安裝包中的寶石安裝但沒有任何工作。

+0

我面臨同樣的問題。解決了! http://stackoverflow.com/a/18096502/1524350 –

回答

3

我做了什麼來解決這個問題是一個小技巧:

  1. 刪除耙的所有版本
  2. 刪除Gemfile.lock的
  3. 運行捆綁安裝
  4. 與手動安裝的Rake:寶石安裝rake --version = 10.0。2

現在它正在工作,但由於某種原因,它不寫入日誌文件。我會修復它併發布更新。

0

這就是您在運行rake任務時或者在設置rake任務時使用cron時出現的錯誤?如果你認爲它是無論什麼寶石,我知道關於什麼時候不工作有很多討論,因爲卡皮斯特拉諾實際上改變了一些內部,他們一直在慢慢修復它們,但他們沒有發佈更新的寶石。

運行通過他們的問題搜索,看看你能找到什麼是關係到你:

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

+0

我覺得Capistrano的和因爲任務是在一次執行每當工作正常,但在執行任務的時候,因爲它沒有找到問題就來了耙寶石。 – pablomarti

10

您可以使用

bundle install --path vendor/cache 

希望這有助於你。

+0

我運行該命令,但後來在文件cron.log(我從Whenever生成,將其添加到crontab中)不顯示任何內容。如果我刪除文件,1分鐘後生成,但空的...我不知道它可能是什麼。 – pablomarti

+1

這解決了這個問題。但是,請你解釋一下爲什麼解決這個問題,首先出了什麼問題? – Das

+1

對此的解釋會很有用:) – ethicalhack3r

0

這個問題實際上是由於BUNDLE_PATH重寫RVM寶石設置和其他地方存放下載的文件是每次運行捆綁安裝。要解決此問題,您可以刪除.bundle文件夾,也可以從.bundle/config中刪除BUNDLE_PATH行。只要一旦完成就重新運行軟件包安裝,你應該很好去!

2

只是一個bundle install爲我工作。我認爲這是因爲我更新了Ruby,但之後忘了運行捆綁器。

+0

謝謝,您的解決方案爲我工作。 –

相關問題