2011-11-23 57 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"