无法让bundle exec在生产中工作

nfm*_*nfm 16 rubygems ruby-on-rails bundler

我已经在生产中安装了我的宝石:

cd /app/releases/current && bundle install --gemfile /app/releases/current/Gemfile --path /app/shared/bundle --deployment --quiet --without development test
Run Code Online (Sandbox Code Playgroud)

我不能bundle exec用我的任何宝石(除了rakegem):

$ bundle exec whenever
bundler: command not found: whenever
Install missing gem executables with `bundle install`
Run Code Online (Sandbox Code Playgroud)

宝石正确安装在/ app/shared/bundle中:

$ 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
Run Code Online (Sandbox Code Playgroud)

我的(生成的)bundle配置(在/app/current/.bundle/config中)是:

---
BUNDLE_FROZEN: "1"
BUNDLE_PATH: /app/shared/bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"
BUNDLE_WITHOUT: development:test
Run Code Online (Sandbox Code Playgroud)

我正在运行ruby 1.9.2p290,手动安装到/ usr/local/bin.

我有选择的bundle install宝石--binstubs吗?为什么不bundle exec搜索存储的BUNDLE_PATH

Cca*_*lop 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
Run Code Online (Sandbox Code Playgroud)


nfm*_*nfm 0

我将--pathfrom更改/app/shared/bundlevendor/bundle,这使其工作。

这对我来说似乎是错误的,所以我删除了/app/shared/bundlevendor/bundle,然后bundle install再次运行到/app/shared/bundle

这次干净bundle install解决了问题。我不知道为什么!

如果有人对此有解释,我很乐意将您标记为已接受的答案。但这解决了我的问题。