【问题标题】:Capsistrano, Gemfile not found errorCapsistrano,未找到 Gemfile 错误
【发布时间】:2015-02-07 19:56:20
【问题描述】:

我正在使用 jruby 1.7、puma 和 capistrano 以及 rails 4 应用程序。

目前我有 1 个 capistrano 无法运行的命令:

Command: 
cd /path_to_my_application/deploy/releases/20141209190535 && ( PATH=$HOME/jdk/bin:$PATH RAILS_ENV=staging ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )

DEBUG[d1a0d859]     Could not locate Gemfile

在此命令出现错误之前,它确实收到了相同的错误消息Could not locate Gemfile

Command: cd /path_to_my_application/deploy/releases/20141209190535 && ( PATH=$HOME/jdk/bin:$PATH ~/.rvm/bin/rvm default do bundle install --binstubs /path_to_my_application/deploy/shared/bin --gemfile path_to_my_application/current/my_app/Gemfile --path /apath_to_my_application/deploy/shared/bundle --without development test --deployment --quiet )

但后来我添加了这些行

set :bundle_gemfile, "#{release_path}/housingsystem/Gemfile" SSHKit.config.command_map[:rake] = "bundle exec rake" 到我的my_app/config/deploy/staging.rb 然后它开始工作,直到预编译任务开始说Could not locate Gemfile

知道是什么原因造成的吗?

我的 Gemfile 看起来像这样:

group :development, :test do
  # Use Capistrano for deployment
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
  gem 'capistrano-rvm'
  gem 'capistrano3-puma'
  # Create architecture diagrams
  gem 'railroady'
end

我的 Capfile 看起来像这样:

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Includes tasks from other gems included in your Gemfile

# https://github.com/capistrano/rvm
require 'capistrano/rvm'

# https://github.com/capistrano/bundler
require 'capistrano/bundler'

# https://github.com/capistrano/rails
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

# https://github.com/seuros/capistrano-puma
require 'capistrano/puma'

# https://github.com/javan/whenever#capistrano-v3-integration
require 'whenever/capistrano'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

那么知道为什么PATH=$HOME/jdk/bin:$PATH RAILS_ENV=staging ~/.rvm/bin/rvm default do bundle exec rake assets:precompile告诉我找不到 Gemfile 吗?

【问题讨论】:

  • 你使用 rvm/rbenv 吗?
  • 是的,我使用 rvm 进行 ruby​​ 版本控制
  • gemfile 在哪里(请说)?这是/path_to_my_application/deploy/releases/20141209190535吗?
  • 如果是,请尝试将您的用户的bundle 替换为~/.rvm/wrappers/ruby-x.x.x@projectX/bundle~/home/user
  • 我根据此处stackoverflow.com/questions/12641837/… 的最后一个答案手动添加了捆绑包,但我仍然遇到同样的错误。

标签: ruby-on-rails capistrano jruby puma


【解决方案1】:

尝试设置

set :puma_prune_bundler, true

https://github.com/puma/puma/issues/329

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-20
    • 2012-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多