I originally had ruby 1.9.3 installed on my computer as the only ruby version. I would like to make an app for Heroku which requires ruby 2.0.0. I just successfully installed ruby-2.0.0-p353 onto my computer and would like to use that for a single app. How can I do this?
You can specify a Ruby version in your Gemfile by adding: ruby "2.0.0"
For more info: https://devcenter.heroku.com/articles/ruby-versions
If you use rvm or rbenv you can have default version 1.9.3, and for any project set version 2.0.0 in .ruby-version or Gemfile
See https://rvm.io/workflow/projects
Related
I am trying to upgrade from ruby 2.3.0 to 2.4.1.
To do this, I did rvm use 2.4.1#my-project --create (I am already using 2.4.1 for another project). I changed the gemfile from ruby "2.3.0" to ruby "2.4.1", and I ran bundle install. My gemfile.lock correctly changed.
However, when trying to run rails s in console, I have the error:
Your Ruby version is 2.3.1, but your Gemfile specified 2.4.1
This is not logical because when I am running which ruby I get the following answer : /.rvm/rubies/ruby-2.4.1/bin/ruby. ruby -v answers ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]. Furthermore I have never used 2.3.1 for any of my projects; when running rvm list in console, I do not see that version of ruby.
Is it possible that there is a conflict with rails? I am using rails 4.2.7.1
I tried all the answered given in the following stackoverflow issues:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0
Your Ruby version is 2.3.0, but your Gemfile specified 2.1.2
Your Ruby version is 2.3.1, but your Gemfile specified 2.1.4
How to fix "Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0"
Your Ruby version is 2.2.4, but your Gemfile specified 2.3.0?
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0
So I am kind of running out of ideas. Thank you for your help!
I faced same issue, stopping spring and clearing tmp, which includes bootsnap cache worked for me
spring stop
rake tmp:clear
How can I update my ruby version to from 2.2.4 to 2.3.1
I am new to Ruby, I am using windows 8 and I do not have any ruby version manager install.
I can not change the ruby version on the gem file because I have to use the ruby version everybody else is using. So changin the ruby version on the gem file is not a solution
I can not use a ruby version manager.
Use RubyInstaller to install version 2.3.1.
I have ruby 2.0 that is what comes up with ruby -v command
but I want to use ruby 1.9.3 because a gem I want to use for a project only suppoerts up to that version.
I have included:
ruby '1.9.3'
in my gemfile and get the following error when running bundle install:
Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3
how can I use ruby 1.9.3? Where can I download it from I cannot find it? I still want to keep ruby 2.0 since I use it for a bunch of other projects how can I use both for different projects?
I am on a windows.
First of all the download: http://rubyinstaller.org/downloads/archives
If you run it from cmd, you have to change the PATH variable to your target ruby version.
It seems rails server uses different ruby then the one that is set up by rvm.
How to make the rails server command use the same ruby as its set up in the rvm?
When I start the rails server, (write rails server in console) it outputs
ruby 1.8.7 for ruby version.
But when I write
`ruby -v`
to see the ruby version, I get ruby 1.9.3p0 for ruby version.
Also I have installed rvm and when I type
rvm list
it returns that I'm using ruby-1.9.3-p286, so rvm uses different ruby version than the rails server.
I need to be able to start rails server with ruby-1.9.3.
First I have installed ruby 1.8.7 that I installed rvm so I can use ruby-1.9.3.
But it seems that I still can't use it with rails server.
Thanks
When you say "rails server", how are you running the server? Is it through Bundler? Or through a terminal command?
I believe each rvm Ruby version has its own Bundler (which uses the correct Ruby version specified from rvm). If you were to do rvm install ruby-2.x.x, you'll most likely run into ERROR: Gem bundler is not installed, run 'gem install bundler' first. Once you have run bundle exec rails console and are in the console, you can run RUBY_VERSION to see which version you're running.
If you're simply calling rails server, then your PATH might be messed up. You could run which -a rails to see the list of directories your computer searches through for the executables. If you see something like /usr/bin/rails, then this rails server version probably uses the system version of Ruby. I suspect that might be why the rvm Ruby version and Rails Ruby version are different.
the easiest way it to have .rvmrc file in the app directory where you specify which version of ruby you want to use
echo "rvm use 1.9.3" >> .rvmrc
I am using Ruby on Rails 3.2.2 and RVM (Ruby Version Manager). By using RVM I installed 2 Ruby versions: first 1.9.3 and then 1.9.2. After I run the rvm use --default 1.9.2 command line I closed and reopened the Terminal window. Finally I run the following command lines in the Terminal window:
$ which ruby
/<MY_USER_PATH>/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
$ ruby -v
ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin10.8.0]
However, if I add the <%= "Ruby version #{RUBY_VERSION}" %> code in a view file of my Ruby on Rails project I get Ruby version 1.9.3.
Why my Ruby on Rails project is still running with the Ruby version 1.9.3? How can I make that to run in Ruby 1.9.2?
Passenger doesn't care about RVM, you need to compile Passenger with the Ruby version you want to use, and follow its instructions to setup Apache's configuration accordingly.
If you want to switch Ruby versions, you need to reinstall Passenger's Apache module via passenger-install-apache-module and follow the instructions.
You will likely see that the PassengerRuby directive in your Apache config is pointing to a specific ruby.
If you need different Ruby versions with Passenger, Phusion's blog post on this may be helpful. RVM's docs on Passenger integration are worth reading as well.
I would guess that Apache (Passenger?) is using your globally installed version of Ruby, which looks like ruby 1.9.2. Do a sudo su and then try which ruby and see if you're still pointing to the RVM version of ruby. That version of Ruby is the one that Apache is using, you'd have to setup ruby globally to allow Apache (Passenger) to use it.