Issue with Rails after RVM installation - ruby-on-rails

I had the Rails 3.2.9 installed before I did the following.
I installed RVM using the command 'curl -L https://get.rvm.io | bash -s stable --ruby' referring https://rvm.io/rvm/install/
Then ruby 1.8.7 and 1.9.3 were installed using command rvm install [x]' ([x] stands the version) and I set ruby 1.9.3 as default using the command 'rvm use 1.9.3 --default'. Earlier I was using '1.8.7' which was installed before installing RVM. Now when I type 'rails -v' in the command prompt I am getting the following error.
/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in
to_specs': Could not find railties (>= 0) amongst [bundler-1.2.3,
rake-10.0.2, rubygems-bundler-1.1.0, rvm-1.11.3.5] (Gem::LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:into_spec'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1208:in `gem'
from /usr/local/bin/rails:18
Please help me to resolve the same. Good responses will always be appreciated.

since you are using rvm you need to install rails 3.2.9 before doing rails -v try this command
gem install rails -v 3.2.9
and then try rails -v

From the Question itself it is known that the issue is with some of the gem dependencies. So after setting up RVM, I updated the gems and installed rails using gem command once again. Then restarted the terminal. Wow, It works!! 'rails -v' outputs Rails 3.2.9.
One more thing I want to tell you that if you are using bash, just execute the command '/bin/bash --login' before setting the default ruby version. Otherwise it will throw the error shown below.
'RVM is not a function, selecting rubies with 'rvm use ...' will not work.'
Thanks for all your responses.

Try passing --default to set the default ruby version
rvm use 1.9.3 --default

Related

Trying to install Rails 6 using RVM

I have installed RVM successfully on my Mac and using it I have installed Ruby 2.6.3. I have set my current and default version of Ruby to be 2.6.3. Everything seems to be fine because when I enter ruby -v into the terminal it tells me I'm using ruby 2.6.3.
My problem comes when I try to install Rails 6, I'm entering:
gem install rails --version=6.0.0 -no-ri -no-rdoc
It seems to install correctly however when I try to confirm with:
rails -v
I get:
Rails 6 requires Ruby 2.5.0 or newer.
You're running
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64- darwin18]
Please upgrade to Ruby 2.5.0 or newer to continue.
Why am I getting this message when my ruby -v command is telling me that I am using ruby 2.6.3
Any help would be very welcome.
You're running ruby 2.3.7p456. You need to set your local ruby version to 2.6.3.
Try which ruby to see which ruby version is loaded.
rvm install 2.6.3
rvm use 2.6.3
You can then see which ruby is running with which ruby.
See the basics on the rvm docs
As an aside, I also recommend recommend rbenv over rvm; however, you can only have one installed. If you have both installed, you're going to have a bad time.
To make sure you do not have both installed try which rbenv, and that should return rbenv not found
Please edit your original question with the output of the following commands:
which -a ruby
echo $PATH (That will help debug if your $PATH is set up incorrectly.)
which rbenv
ls (in your project directory)
i also had the similar problem which i resolved by uninstalling rvm completely and then installing rbenv.

Failed gem install: gem require ruby-2.6.1 but the currently ruby-2.6.1

Show messages errors:
Required ruby-2.6.1 is not installed.
To install do: 'rvm install "ruby-2.6.1"'
ruby -v
ruby 2.6.1p33 (2019-01-30 revision 66950) [x64-mingw32]
rails -v
Rails 5.2.2
First of all, I doubt that RVM may not be updated to support this version of Ruby. As I know the following version is supported, you can version by following command and response should match.
rvm --version
1.29.7
If you have updated version then I will do the following to check if RVM has also the same version of ruby installed.
I will check the content of my project root folder's following file
cat .ruby-version
If it has mention same, as rvm is also complaining that I will run the following command on rvm to check if this ruby is really installed in RVM
rvm list
It will show a list of rubies installed and it should include 2.6.1 in the end. If you can't see this list then you probably need to install using the following command
rvm install "ruby-2.6.1"
If it is showing than can you try the following command and see what result comes
rvm use 2.6.1
If all good, then try the following command to see which ruby is being used
which ruby
response must include .rvm/rubies/ mean you are using .rvm ruby otherwise, you may using the system built in ruby.
Just wrote may help you to diagnos issue.
Are you using rbenv? If so, I'd recommend running rvm implode as described here.
if you are using rbenv
see if you have it available in your list :
rbenv install --list | grep 2.6.1
if not, fetch it
cd ~/.rbenv/plugins/ruby-build && git pull && cd -
now if you try again
rbenv install -l | grep 2.6.1
so just run the installation command:
rbenv install 2.6.1
Downloading ruby-2.6.1.tar.bz2... 08:36:17
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.1.tar.bz2
Installing ruby-2.6.1...
Installed ruby-2.6.1 to ~/.rbenv/versions/2.6.1
now you can use it for global or local projects. if local :
rbenv local 2.6.1

Error on install gem factory_girl and ruby version

I try to install skylinecms but I have a problem with installing the gem.
The gem factory_girl asked me to use version> = 1.9.2 of Ruby
atmoner#atmoner:~/base_ror$ sudo gem install skylinecms
ERROR: Error installing skylinecms:
factory_girl requires Ruby version >= 1.9.2.
ruby -v
atmoner#atmoner:~/base_ror$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
I have tried to change ruby version to 1.9.2
atmoner#atmoner:~/base_ror$ rvm use 1.9.2
Using /home/atmoner/.rvm/gems/ruby-1.9.2-p320
But still same problem
atmoner#atmoner:~/base_ror$ sudo gem install skylinecms
ERROR: Error installing skylinecms:
factory_girl requires Ruby version >= 1.9.2.
what's the source of this problem?
you have an idea?
You shouldn't use sudo with rvm, as it creates a new subshell with a completely new environment. See more about sudo and rvm here: RVM and 'sudo'
Most likely your system ruby version is 1.8.7, and that is what is getting invoked when you run sudo gem install skylinecms. You can verify that with the following commands:
rvm use system
ruby -v
Try installing the skylinecms gem without sudo.
Best to use per-project gemsets as suggested in rvm best practices

Rails Installation Error in ubantu12.04

I have already installed Ruby 1.9.3,gem 1.8.24, using RVM in ubantu 12.04. But when I instll rails using gem using command gem install rails , then rails is installed with following message:Successfully installed rails-3.2.6
1 gem installed
Installing ri documentation for rails-3.2.6...
Installing RDoc documentation for rails-3.2.6...
But when I check the version of rails then following error occurThe program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I need help. Thank you?
rvm use 1.9.3 --default
gem install rails
Then run rails -v
Try this:
run this command
source /etc/profile
Then, run rails -v
First try with
rvm list
to get all ruby version then run following cmd to set one of ruby as default
First you have to set
rvm use 1.9.3 --default
Then try cmd
rails -v

Gem error when Installing ruby 1.9.2 on CentOS 5.4 via RVM

I installed RVM 1.6.5 on my Centos 5.4. Everything went well, but when I try and use the gem command I get the error.
usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:28:in `': uninitialized constant Gem::ConfigFile (NameError)
I cant seem to find any answers on google for this error. Ruby was installed as root. Does anyone have any idea on how I would start troubleshooting this problem. Thank you.
You have to completely remove rvm, reinstall it and install 1.8.7 before 1.9.2-head
rvm implode
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
rvm install 1.8.7
rvm use 1.8.7
rvm --default install 1.9.2-head
looking at the path you posted, it looks like you tried to install some Ruby 1.9.1 gems underneath Ruby 1.9.2,
e.g. using Ruby 1.9.2 as the default ruby version... weird... that looks really odd!
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:28:in

Resources