bundle命令的Gemfile错误

时间:2012-06-05 18:01:55

标签: heroku bundle nomethoderror gemfile

我是应用程序的合作者,我克隆了,并且在我的协作者的计算机上一切都运行得很好。但是,当我在我的Heroku应用程序的根目录中键入bundle exec或bundle install时,出现以下错误:

/Users/jacob/furious-ocean-6331/Gemfile:3:in `evaluate': undefined method `ruby' for # <Bundler::Dsl:0x007fcda31048c0> (NoMethodError)
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/dsl.rb:7:in `instance_eval'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler1.1.4/lib/bundler/dsl.rb:7:in `evaluate'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/definition.rb:18:in `build'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler.rb:135:in `definition'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler1.1.4/lib/bundler/cli.rb:220:in `install'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler1.1.4/lib/bundler/vendor/thor/task.rb:22:in `run'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/vendor/thor.rb:263:in `dispatch'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/lib/bundler/vendor/thor/base.rb:386:in `start'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.4/bin/bundle:13:in `<top (required)>'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/bin/bundle:19:in `load'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/bin/bundle:19:in `<main>'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
       /Users/jacob/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
There was an error in your Gemfile, and Bundler cannot continue.

这是Gemfile:

source 'https://rubygems.org'

ruby '1.9.3'
gem 'rails', '3.2.2'

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'nokogiri'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem "json", "~> 1.7.3"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
end

gem 'thin'

gem "heroku"

gem 'jquery-rails'

group :development, :test do
    gem 'sqlite3'
end

group :production do
    gem 'pg'
end


# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

3 个答案:

答案 0 :(得分:9)

您的Gemfile中的ruby元素仅适用于Bundler的预发布版本,请确保

gem install bundler --pre

确保您在bundler的预发布版本上运行,该版本添加了对指定ruby版本的支持。

答案 1 :(得分:2)

要解决此问题,请安装Bundler 1.2.0的预发行版。您不能简单地升级到预发布版本。您必须先卸载然后再安装。

$ gem uninstall -ax bundler
$ gem install bundler --pre
$ bundle --version

然后运行

 $ bundle install

安装Gemfile中指定的gems

答案 2 :(得分:0)

此方法是从捆绑包1.2:

添加的

http://bundler.io/v1.2/gemfile.html

确保您的bundle --version足够新。