Why I get syntax error in Rails console if my ruby version is correct?

I added gem 'pry-rails' and when i run rails console i receive following error:

Loading development environment (Rails 3.2.6)
/Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler/dsl.rb:35:in `eval_gemfile': Gemfile syntax error: (Bundler::GemfileError)
/Users/rege/Code/Network/Gemfile:106: syntax error, unexpected ':', expecting $end
gem 'ruby-readability', require: 'readability'
                                ^
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler/dsl.rb:7:in `evaluate'
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler/definition.rb:18:in `build'
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler.rb:144:in `definition'
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler.rb:112:in `setup'
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler/setup.rb:17

Frame number: 0/4
>> RUBY_VERSION
"1.9.3"

My Gemfile:

...
group :development do
  gem 'rack-mini-profiler'
  gem 'pry-rails'
end
...
gem 'ruby-readability', require: 'readability'
...

When I change gem 'ruby-readability', require: 'readability' to gem 'ruby-readability', :require => 'readability' I get next error:

Loading development environment (Rails 3.2.6)
/Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler/definition.rb:364:in `validate_ruby!': Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3 (Bundler::RubyVersionMismatch)
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler.rb:112:in `setup'
    from /Users/rege/.rvm/gems/ruby-1.9.3-p194@network/gems/bundler-1.2.0/lib/bundler/setup.rb:17

My rvm info

> rvm info                                                                                                                                                     /Users/rege/Code/Network 1.9.3p194 develop!@37a80c4

ruby-1.9.3-p194@network:

  system:
    uname:       "Darwin Darek-MacBook.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
    zsh:         "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"

  rvm:
    version:      "rvm 1.15.8 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "19 hours 59 minutes 37 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "x86_64-darwin11.4.0"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]"

  homes:
    gem:          "/Users/rege/.rvm/gems/ruby-1.9.3-p194@network"
    ruby:         "/Users/rege/.rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/Users/rege/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/Users/rege/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/Users/rege/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/Users/rege/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"

  environment:
    PATH:         "/Users/rege/.rvm/gems/ruby-1.9.3-p194@network/bin:/Users/rege/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/rege/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/rege/.rvm/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
    GEM_HOME:     "/Users/rege/.rvm/gems/ruby-1.9.3-p194@network"
    GEM_PATH:     "/Users/rege/.rvm/gems/ruby-1.9.3-p194@network:/Users/rege/.rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/Users/rege/.rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/Users/rege/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       "network"

Answers


What does rvm info say about your environment? What about ruby -v? Finally, which ruby? I suspect that you're not running the correct ruby, perhaps there's another one on your path.


According to this documentation you should specify like

 gem "ruby-readability", :require => 'readability'

which you have already done in your second approach. You are getting this error

 Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3

Because from Bundler 1.2 you have this pretty useful new feature of validate your Ruby version so if you want to use ruby 1.8.7 specify at top of your Gemfile like

ruby '1.8.7'

Problem was because I had in my pryrc: require 'pry-vterm_aliases' after removed this from my pryrc problem solved


Need Your Help

How do I achieve this layout without using Javascript?

javascript css css3

I want a basic full width layout with a 250px sidebar on the right. Here's roughly what I want:

Proper Type for Date Object That Needs to be a LocalDate

java architecture jodatime service-layer

If I would like to incorporate the JodaTime library into my MVC project. What would be the best way to write the setter/getter methods for my bean? I've currently tied my local variables to the Loc...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.