2011-11-23 58 views
15

我安裝我的寶石生產一起工作:無法取得束EXEC生產

cd /app/releases/current && bundle install --gemfile /app/releases/current/Gemfile --path /app/shared/bundle --deployment --quiet --without development test 

我不能bundle exec我的任何寶石(除rakegem):

$ bundle exec whenever 
bundler: command not found: whenever 
Install missing gem executables with `bundle install` 

的寶石是否正確安裝在/ app /共享/捆紮:

$ cd /app/shared 
$ find . -name whenever 
./bundle/ruby/1.9.1/gems/whenever-0.6.8/bin/whenever 
./bundle/ruby/1.9.1/gems/whenever-0.6.8/lib/whenever 

我(GE nerated)軟件包配置(在/app/current/.bundle/config)是:

--- 
BUNDLE_FROZEN: "1" 
BUNDLE_PATH: /app/shared/bundle 
BUNDLE_DISABLE_SHARED_GEMS: "1" 
BUNDLE_WITHOUT: development:test 

我運行紅寶石1.9.2p290,手動安裝到/ usr/local/bin目錄。

我必須bundle install我的寶石與--binstubs選項?爲什麼bundle exec不能搜索存儲的BUNDLE_PATH

+0

我有類似的問題我用'bundle install --deployment'解決了問題。我不確定**爲什麼**這樣做,所以這就是爲什麼這是一個評論,而不是一個答案。 –

+0

我的capistrano任務在運行'bundle install'時包含'--deployment'參數。你是這個意思嗎?或者你的意思是,刪除'--path'參數? – nfm

+1

您是使用capistrano還是進行手動部署? – Nick

回答

0

測試或開發部分,我改變了--path/app/shared/bundlevendor/bundle,這使得它的工作。

這對我來說似乎是錯的,所以我刪除了/app/shared/bundlevendor/bundle,並且再次運行bundle install/app/shared/bundle

這個乾淨的bundle install修復了這個問題。我不知道爲什麼!

如果有人對此有解釋,我很樂意將您標記爲已接受的答案。但是這爲我解決了這個問題。

0

我認爲,當創業板時是不是在你的Gemfile,或者是在你的Gemfile

+0

感謝您的建議。我在Gemfile的主體中有'gem'。 – nfm

8

使用Capistrano和Rails並使用deploy.rb作爲部署程序文件。

我意識到改變出現的順序require "whenever/capistrano"真的很重要。我把那幾乎在最後一行:

在deploy.rb:

#first lines: 
set :rvm_ruby_string, "1.9.3" 
set :rvm_type, :user 
set :whenever_command, "bundle exec whenever" 

# others... 

# last lines 
require 'rvm/capistrano' 
require 'bundler/capistrano' 
require "whenever/capistrano" 

after "deploy:update_code", "customs:config" 
after "deploy:create_symlink","deploy:create_symlink" 
after "deploy", "deploy:cleanup" 

load 'deploy/assets' 
# end 
+0

你搖滾,謝謝! – ipd

+0

沒有爲我解決問題。 – Jan

+0

這個解決方案讓我走上了正確的軌道,但沒有按照描述的那樣工作。在最後一行的/ capistrano「'對我來說,在deploy.rb的第一行放置'require'bundler/capistrano'','require'。 – Jos

0

可能不同的問題導致同樣的錯誤消息。對於我來說,每次更新gem以獲得角色支持後,我都必須更新capistrano gem。 bundle exec在每次升級之前都有工作。

1

檢查您的bundle:install的設置位置,然後嘗試移動它,需要deploy.rb文件中的'every/capistrano'。

看來這是在我做了一個包更新的時候觸發的,它增加了我Gemfile.lock中的Gem版本。

它看起來像每當我試圖部署文件運行包之前運行它的chrontab更新:https://github.com/javan/whenever/blob/master/lib/whenever/capistrano.rb

before "deploy:finalize_update", "whenever:update_crontab" 

安裝

而且我deploy.rb有

after 'deploy:finalize_update', 'bundle:install' 

像其他人其他人在這個線程中,我嘗試了一些東西,我不確定這是爲我修復了什麼,但將bundle安裝更改爲deploy之前:finalize_update,還有se把它當作上面的「之前」,要求「每當/ capistrano」似乎是我的情景中可能的解決方案。

4

我有這個問題,有需要以正確的順序,即

require 'rvm/capistrano' 
require 'bundler/capistrano' 
require 'whenever/capistrano' 

它仍然想運行包之前crontab的更新:安裝。解決方案是更新我的本地捆綁器與

gem update bundler 

之後,它開始再次工作。不確定在各種版本之間發生了什麼變化,從而破壞了這一切

+0

謝謝你的提示,你需要更新你的LOCAL打包機,我把所有東西都按照正確的順序排列,並且檢查了生產服務器以確保它具有最新版本等,但仍然出現錯誤。一旦我更新我的本地捆綁器一切正常。 正如本捆綁商問題所述,https://github.com/javan/whenever/issues/275捆綁商和每當在過程中或工作出正確的capistrano掛鉤使用。 –

+0

'bundler/capistrano'和'capistrano/bundler'有什麼區別?我在Capfile中有更晚的版本。 –

0

使用brightbox deployment gem,它處理捆綁等我(通過魔術,在其他一些食譜)​​,我發現這工作:

更換

require "whenever/capistrano" 

https://github.com/javan/whenever/blob/master/lib/whenever/capistrano/v2/hooks.rb 內容,然後將它修改爲在捆綁器後加載:安裝完成(您可能有或沒有完成該任務,我不知道它的標準)

# require "whenever/capistrano" 
# hacked whenever/lib/whenever/capistrano/v2/hooks.rb below to work with brightbox bundler installation 

require "whenever/capistrano/v2/recipes" 

# Write the new cron jobs near the end. 
after "bundler:install", "whenever:update_crontab" 
# If anything goes wrong, undo. 
after "deploy:rollback", "whenever:update_crontab"