2

我是该应用程序的合作者,我克隆了该应用程序,并且一切都在我的合作者的计算机上运行良好。但是,当我在 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.

这是宝石文件:

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'
4

3 回答 3

9

您在 Gemfile 中拥有的ruby元素仅适用于 Bundler 的预发布版本,请确保您这样做

gem install bundler --pre

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

于 2012-06-05T19:00:52.977 回答
2

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

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

然后运行

 $ bundle install

安装 Gemfile 中指定的 gem

于 2012-06-06T05:11:58.303 回答
0

这个方法是从 bundle 1.2 开始添加的:

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

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

于 2013-10-30T00:28:50.213 回答