0

在 blog 文件夹内运行 rails 服务器(我也已成功在 blog 文件夹中安装了所需的包)我收到此错误:

/usr/lib/ruby/vendor_ruby/bundler/resolver.rb:423:in `block in error_message': undefined method `>' for < 2.0, >= 1.3.0:Gem::Requirement (NoMethodError)
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:410:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:410:in `inject'
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:410:in `error_message'
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:391:in `version_conflict'
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:129:in `block in resolve'
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:127:in `catch'
from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:127:in `resolve'
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:151:in `resolve'
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:90:in `specs'
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:135:in `specs_for'
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:124:in `requested_specs'
from /usr/lib/ruby/vendor_ruby/bundler/environment.rb:23:in `requested_specs'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:11:in `setup'
from /usr/lib/ruby/vendor_ruby/bundler.rb:107:in `setup'
from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:7:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/ayush/Rails/blog/config/boot.rb:4:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'

这是 Gemfile

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use mysql as the database for Active Record
gem 'mysql2'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'


# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. 
gem 'turbolinks'

# Build JSON APIs with ease.
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

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

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

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

引导文件

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

请指出我哪里出错了。我也是这个论坛的新手,所以如果我在发布问题时做错了什么,请告诉我。顺便说一句,我正在使用 ubuntu 终端。我在用

导轨 4.0.0

ruby 1.9.3p0(2011-10-30 修订版 33570)[x86_64-linux]

Mysql2 用于我的数据库

在敲打我的头的日子里,我认为这是由于红宝石和导轨不兼容......谁能告诉我如何解决这个问题?

4

1 回答 1

0

我终于解决了。

rails 和 ruby​​ 的兼容性存在一些错误,我通过完全删除 ruby​​1.8 版本解决了这个问题,因为它以某种方式手动选择它。

于 2013-07-10T11:16:19.437 回答