Incorrect ruby ​​version used

I am trying to make rails work on my mac, which works with a lion. I am using rvm and it shows that I am using ruby ​​1.9.2p312, but when I go to start the server I get an error message referring to ruby ​​1.8 and that the rails are not installed, although before that mistakes. I started the installation of the package and it installed everything that I needed successfully.

Any ideas on how to solve this?

Well, it seems like the 1.8 bug has disappeared. Here is a new bug and package display:

bundle exec rails s /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require': no such file to load -- spec (LoadError) from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' from /Users/anthonyd/Sites/rails/reminders/config/application.rb:7:in `<top (required)>' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:52:in `require' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:52:in `block in <top (required)>' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap' from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:49:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>' bundle show Gems included by the bundle: * actionmailer (3.1.3) * actionpack (3.1.3) * activemodel (3.1.3) * activerecord (3.1.3) * activeresource (3.1.3) * activesupport (3.1.3) * arel (2.2.1) * aws-s3 (0.6.2) * bbenezech-nested_form (0.0.2) * bcrypt-ruby (3.0.1) * bootstrap-sass (1.4.0) * builder (3.0.0) * bundler (1.0.21) * coffee-rails (3.1.1) * coffee-script (2.2.0) * coffee-script-source (1.1.3) * devise (1.5.2 b303429) * diff-lcs (1.1.3) * erubis (2.7.0) * execjs (1.2.9) * haml (3.1.4) * hike (1.2.1) * hpricot (0.8.5) * i18n (0.6.0) * jquery-rails (1.0.19) * json (1.6.3) * kaminari (0.12.4) * mail (2.3.0) * mime-types (1.17.2) * multi_json (1.0.4) * nokogiri (1.5.0) * orm_adapter (0.0.5) * polyglot (0.3.3) * rack (1.3.5) * rack-cache (1.1) * rack-mount (0.8.3) * rack-pjax (0.5.5) * rack-ssl (1.3.2) * rack-test (0.6.1) * rails (3.1.3) * rails_admin (0.0.1 6120ad4) * railties (3.1.3) * rake (0.9.2.2) * rdoc (3.11) * remotipart (1.0.1) * rspec (2.7.0) * rspec-core (2.7.1) * rspec-expectations (2.7.0) * rspec-mocks (2.7.0) * sass (3.1.11) * sass-rails (3.1.5) * sprockets (2.0.3) * sqlite3 (1.3.4) * sqlite3-ruby (1.3.3) * thor (0.14.6) * tilt (1.3.3) * treetop (1.4.10) * tzinfo (0.3.31) * warden (1.1.0) * xml-simple (1.1.1) rails s /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem' from /usr/bin/rails:18 **ruby -v** ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.2.0] **RVM Info**: system: uname: "Darwin Anthony-DeFreitass-MacBook-Pro.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.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.10.0-pre by Wayne E. Seguin ( wayneeseguin@gmail.com ) [https://rvm.beginrescueend.com/]" ruby: interpreter: "ruby" version: "1.9.2p312" date: "2011-08-11" platform: "x86_64-darwin11.2.0" patchlevel: "2011-08-11 revision 32926" full_version: "ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.2.0]" homes: gem: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head" ruby: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head" binaries: ruby: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/ruby" irb: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/irb" gem: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/gem" rake: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head/bin/rake" environment: PATH: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head/bin:/Users/anthonyd/.rvm/gems/ ruby-1.9.2-head@global /bin:/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin:/Users/anthonyd/.rvm/bin:/usr/bin:/usr/local/bin:/Users/anthonyd:/Users/anthonyd/imagemagick/bin:/Users/anthonyd/imagemagick/lib:.rvm/scripts/rvm:/usr/local/sbin:/usr/local/mysql/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" GEM_HOME: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head" GEM_PATH: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head:/Users/anthonyd/.rvm/gems/ ruby-1.9.2-head@global " MY_RUBY_HOME: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head" IRBRC: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/.irbrc" RUBYOPT: "" gemset: "" 
+4
source share
3 answers

If you use RVM, make sure that in your ~ / .bash_profile file the path for rvm comes before other paths.

For example, put this in your ~ / .bash_profile file before any PATH declarations:

 export PATH=:~/.rvm/bin/:~/.rvm/gems/gems/ 

Then the rest of your export declarations, which may look like this (this is just an example, you do not need to insert it, I just turn it on so you can see how the file looks, but you definitely need it above the line):

 export PATH=:~/bin/:/usr/local/Cellar/mysql/bin:/usr/local/Cellar:/usr/local/sphinx:/usr/sbin:$PATH 

Finally, if, like me, you dropped RVM and went with rbenv, then replace the first export PATH line with this:

 export PATH="$HOME/.rbenv/bin:$PATH" 

These changes should make the system watch your RVM files before they are built into /System/Library/Frameworks/Ruby.framework

Good luck.

+5
source

I see that this has been answered, but I would recommend just typing

gem install bundler or gem update bundler

It fixes the OP problem without changing your Bash_profile.

+2
source

I think you need to run bundle exec rails s when using bundle and rvm with different versions of rails.

0
source

Source: https://habr.com/ru/post/1384237/


All Articles