Rails - Ruby版本与gemfile规范相同但仍然出错

时间:2016-09-03 10:18:00

标签: ruby-on-rails ruby gemfile

当我运行rails c时,我收到以下错误:

Your Ruby version is 2.0.0, but your Gemfile specified 2.2.3

当我运行ruby -v时,我得到以下输出:

ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

我的gemfile包括:

ruby '2.2.3'

如果我使用的是我的gemfile中指定的ruby版本,为什么会收到此错误?

编辑:

我已尝试过this question(运行gem install bundlergem update bundler)的解决方案,但没有成功。

我使用的是rvm,我的rvm list输出是:

rvm rubies

   ruby-2.0.0-p643 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]
   ruby-2.2.0 [ x86_64 ]
   ruby-2.2.2 [ x86_64 ]
=* ruby-2.2.3 [ x86_64 ]
   ruby-2.3.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Gemfile.lock的:

GIT
  remote: git://github.com/thedarkone/rails-dev-boost.git
  revision: a709a10b06b7d9fc4a9846bc613c60c86af9dd7c
  specs:
    rails-dev-boost (0.3.0)
      railties (>= 3.0)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.6)
      actionview (= 4.2.6)
      activesupport (= 4.2.6)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.6)
      activesupport (= 4.2.6)
      globalid (>= 0.3.0)
    activemodel (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
    activerecord (4.2.6)
      activemodel (= 4.2.6)
      activesupport (= 4.2.6)
      arel (~> 6.0)
    activesupport (4.2.6)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.4.0)
    arel (6.0.3)
    autoprefixer-rails (6.3.6.1)
      execjs
    bcrypt (3.1.11)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (3.3.6)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap3-datetimepicker-rails (4.17.37)
      momentjs-rails (>= 2.8.1)
    builder (3.2.2)
    byebug (9.0.3)
    capybara (2.7.1)
      addressable
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.8)
      climate_control (>= 0.0.3, < 1.0)
    coderay (1.1.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.2)
    cookiejar (0.3.0)
    css_parser (1.3.7)
      addressable
    daemons (1.2.3)
    database_cleaner (1.5.3)
    debug_inspector (0.0.2)
    devise (4.1.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.1)
      responders
      warden (~> 1.2.3)
    diff-lcs (1.2.5)
    dropzonejs-rails (0.7.3)
      rails (> 3.1)
    em-http-request (1.1.3)
      addressable (>= 2.3.4)
      cookiejar (<= 0.3.0)
      em-socksify (>= 0.3)
      eventmachine (>= 1.0.3)
      http_parser.rb (>= 0.6.0)
    em-socksify (0.3.1)
      eventmachine (>= 1.0.0.beta.4)
    erubis (2.7.0)
    eventmachine (1.2.0.1)
    execjs (2.6.0)
    factory_girl (4.7.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.7.0)
      factory_girl (~> 4.7.0)
      railties (>= 3.0.0)
    faker (1.6.3)
      i18n (~> 0.5)
    faraday (0.9.2)
      multipart-post (>= 1.2, < 3)
    faye (1.1.2)
      cookiejar (>= 0.3.0)
      em-http-request (>= 0.3.0)
      eventmachine (>= 0.12.0)
      faye-websocket (>= 0.9.1)
      multi_json (>= 1.0.0)
      rack (>= 1.0.0)
      websocket-driver (>= 0.5.1)
    faye-websocket (0.10.4)
      eventmachine (>= 0.12.0)
      websocket-driver (>= 0.5.1)
    ffi (1.9.12)
    figaro (1.1.1)
      thor (~> 0.14)
    font-awesome-rails (4.6.3.0)
      railties (>= 3.2, < 5.1)
    formatador (0.2.5)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    guard (2.14.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, < 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-rspec (4.7.2)
      guard (~> 2.1)
      guard-compat (~> 1.1)
      rspec (>= 2.99.0, < 4.0)
    hashie (3.4.4)
    http_parser.rb (0.6.0)
    httpclient (2.8.2.3)
    i18n (0.7.0)
    jbuilder (2.4.1)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.1.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-turbolinks (2.1.0)
      railties (>= 3.1.0)
      turbolinks
    jquery-ui-rails (5.0.5)
      railties (>= 3.2.16)
    json (1.8.3)
    jwt (1.5.1)
    launchy (2.4.3)
      addressable (~> 2.3)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.10)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.0)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0221)
    mimemagic (0.3.0)
    mini_portile2 (2.0.0)
    minitest (5.8.4)
    momentjs-rails (2.11.1)
      railties (>= 3.1)
    multi_json (1.12.0)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    nenv (0.3.0)
    nokogiri (1.6.7.2)
      mini_portile2 (~> 2.0.0.rc2)
    notiffany (0.1.0)
      nenv (~> 0.1)
      shellany (~> 0.0)
    oauth2 (1.1.0)
      faraday (>= 0.8, < 0.10)
      jwt (~> 1.0, < 1.5.2)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    omniauth (1.3.1)
      hashie (>= 1.2, < 4)
      rack (>= 1.0, < 3)
    omniauth-facebook (3.0.0)
      omniauth-oauth2 (~> 1.2)
    omniauth-oauth2 (1.4.0)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    omniauth-stripe-connect (2.3.0)
      omniauth (~> 1.0)
      omniauth-oauth2 (>= 1.0.3)
    orm_adapter (0.5.0)
    paperclip (4.3.6)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (= 0.3.0)
    pg (0.18.4)
    phony (2.15.21)
    phony_rails (0.14.1)
      activesupport (>= 3.0)
      phony (~> 2.12)
    private_pub (1.0.3)
      faye
    pry (0.10.3)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    public_activity (1.5.0)
      actionpack (>= 3.0.0)
      activerecord (>= 3.0)
      i18n (>= 0.5.0)
      railties (>= 3.0.0)
    pusher (1.1.0)
      httpclient (~> 2.7)
      multi_json (~> 1.0)
      pusher-signature (~> 0.1.8)
    pusher-signature (0.1.8)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.6)
      actionmailer (= 4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      activemodel (= 4.2.6)
      activerecord (= 4.2.6)
      activesupport (= 4.2.6)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.6)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.6)
      actionpack (= 4.2.6)
      activesupport (= 4.2.6)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.1.2)
    rb-fsevent (0.9.7)
    rb-inotify (0.9.7)
      ffi (>= 0.5.0)
    rdoc (4.2.2)
      json (~> 1.4)
    responders (2.2.0)
      railties (>= 4.2.0, < 5.1)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    roadie (3.1.1)
      css_parser (~> 1.3.4)
      nokogiri (>= 1.5.0, < 1.7.0)
    roadie-rails (1.1.1)
      railties (>= 3.0, < 5.1)
      roadie (~> 3.1)
    rspec (3.0.0)
      rspec-core (~> 3.0.0)
      rspec-expectations (~> 3.0.0)
      rspec-mocks (~> 3.0.0)
    rspec-core (3.0.4)
      rspec-support (~> 3.0.0)
    rspec-expectations (3.0.4)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.0.0)
    rspec-mocks (3.0.4)
      rspec-support (~> 3.0.0)
    rspec-rails (3.0.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.0.0)
      rspec-expectations (~> 3.0.0)
      rspec-mocks (~> 3.0.0)
      rspec-support (~> 3.0.0)
    rspec-support (3.0.4)
    ruby_dep (1.3.1)
    sass (3.4.22)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    shellany (0.0.1)
    slop (3.6.0)
    sprockets (3.6.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.4)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.11)
    stripe (1.43.0)
      rest-client (~> 1.4)
    thin (1.7.0)
      daemons (~> 1.0, >= 1.0.9)
      eventmachine (~> 1.0, >= 1.0.4)
      rack (>= 1, < 3)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.4)
    toastr-rails (1.0.3)
      railties (>= 3.1.0)
    turbolinks (2.5.3)
      coffee-rails
    twilio-ruby (4.11.1)
      builder (>= 2.1.2)
      jwt (~> 1.0)
      multi_json (>= 1.3.0)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.0)
      execjs (>= 0.3.0, < 3)
    warden (1.2.6)
      rack (>= 1.0)
    web-console (2.3.0)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)
    websocket-driver (0.6.4)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  bootstrap-sass (~> 3.3.6)
  bootstrap3-datetimepicker-rails (~> 4.17.37)
  byebug
  capybara
  coffee-rails (~> 4.1.0)
  database_cleaner
  devise
  dropzonejs-rails
  factory_girl_rails
  faker
  figaro
  font-awesome-rails
  guard-rspec
  jbuilder (~> 2.0)
  jquery-rails
  jquery-turbolinks
  jquery-ui-rails
  launchy
  momentjs-rails (>= 2.9.0)
  omniauth
  omniauth-facebook
  omniauth-stripe-connect
  paperclip
  pg
  phony_rails
  private_pub
  public_activity
  pusher
  rails (= 4.2.6)
  rails-dev-boost!
  rb-fsevent (>= 0.9.1)
  roadie-rails (~> 1.0)
  rspec-rails
  sass-rails (>= 3.2)
  sdoc (~> 0.4.0)
  sqlite3
  stripe
  thin
  toastr-rails
  turbolinks
  twilio-ruby (~> 4.11.1)
  uglifier (>= 1.3.0)
  web-console (~> 2.0)

RUBY VERSION
   ruby 2.2.3p173

BUNDLED WITH
   1.12.5

1 个答案:

答案 0 :(得分:0)

您应该检查项目根目录下是否有.rvmrc.ruby-version.versions.conf等隐藏文件。如果有,请删除它们或使ruby版本与gemfile相同。