Cannot install rails gem - ruby-on-rails

Somehow my rails installation hides itself successfully...
I have:
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm 1.10.0-pre
gem 1.8.10
and I try to install rails:
sudo gem install rails
it works fine:
Successfully installed rails-3.1.3
1 gem installed
Installing ri documentation for rails-3.1.3...
Installing RDoc documentation for rails-3.1.3...
when I do:
rails - v
I get
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Also, when I do
rake
in a rails app root directory, I get:
Missing the Rails gem. Please `gem install -v= rails`, update your
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version
you do have installed, or comment out RAILS_GEM_VERSION to use the
latest version installed.
executing
gem install -v= rails
raises an error:
ERROR: While executing gem ... (ArgumentError)
Illformed requirement ["="]
So apparently it is sitting somewhere and cannot be seen by my environment. I guess installing via apt-get is not an option as I don't want to confuse gem...
Any ideas?
Cheers
Mac

Do not use sudo.
Just gem install rails

Use RVM instead of the packaged ruby/gems distribution. http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Related

Installing Ruby - Digital Ocean - RVM - Unstable ruby version - Can't install Gems

I am trying to install Ruby & Rails on DigitalOcean droplet, I have downloaded ruby 2.5.1 with RVM but when I check version it says 2.31 and when I list available versions I get only 2.5.1.
I have tried rvm use 2.5.1 I got below problem
I fix it by running source ~/.rvm/scripts/rvm , then rvm use 2.5.1 and run bundle install, I get the following error,
can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
Below show the unstable issues faced from RVM and ruby versions
UPDATE
When I ssh into the server and run ruby -v, I get 2.5.1, then if I run
/bin/bash --login
I check ruby -v, its 2.5.1
install ruby 2.5.1 first, from your image it seems rvm already installed correctly
you just need to install it (it shows from your list command)
rvm install 2.5.1
# this to install version 2.5.1
rvm use 2.5.1
# active ruby 2.5.1
ruby -v
# check your version and make sure it said 2.5.1
to install bundler to your home directory use
# after you active ruby 2.5.1 then install bundler
gem install bundler
# my suggestion do not install with sudo
# in case you still has write problem below is other solution suggested [from here][1]
gem install bundler --user-install
This will install Bundler into your home directory. Note that you will need to append ~/.gem/ruby//bin to your $PATH variable to use bundle.

Your Ruby version is 2.2.4, but your Gemfile specified 2.3.0?

I'm trying to bundle install a ruby project in Git Bash but I'm getting the above message.
ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i836-mingw32]
gem -v
2.3.0
New to Ruby so its really frustrating. I'm trying to do the project below
http://www.viralrails.com/?p=25
This happens because you are specifying a Ruby version in your Gemfile (2.3.0) and this version is not installed or is not the current or default version.
Don't remove the line ruby '2.3.0' as someone said above. You app may have dependencies to this version. Do the following:
1) Check if you have Ruby 2.3.0 installed. If you are using rvm this may be done by
rvm list
and if you are using rbenv by
rbenv versions
2) If you don't have this Ruby version in your list of installed versions, then install it by issuing the following command
rvm install 2.3.0
and if you are using rbenv by
rbenv install 2.3.0
3) If you already had Ruby 2.3.0 installed or completed step 2 above, enter your app directory and issue the following command
rvm use 2.3.0
and if you are using rbenv by
rbenv local 2.3.0
Then run
bundle install
and I believe things will be ok.
Hope it helps!
Install bundler after installing ruby 2.4.0.
gem install bundler
If you installed bundler before installing ruby 2.4.0 then you should reinstall bundler or update it.
Also if the above command didn't work.
gem update bundler

"Rails is not currently installed" Error

Hi i'm new to ruby on rails
I have 3 ruby version in my computer.
In a project i had to use rails 3.2.1 and ruby 1.9.2
So I switched using rvm use 1.9.2 in terminal. But after that my rails commands are not detected.
$ rails g model abc
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Why is this happening? And how to solve this?
You may need to differentiate your gem set that contains that specific version of rails from the old ones.
rvm use 1.9.2#new_gem_set_of_yours --create --default
And then retry installing the 3.2.1 rails
gem install rails --version 3.2.1
Or specify the new rails version in your Gemfile and let Bundler take care of it
gem 'rails', '3.2.1'
and run bundle install.
Type in your terminal
gem install rails -v 3.2.1
if it does not work, first try
rvm install 1.9.3
then
rvm rubygems current
and repeat.

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

Why won't my Ubuntu server install Rails 2.3.8?

I have an older Ubuntu server with a Rails app running on version 2.3.5 that I'd like to move to version 2.3.8. The server doesn't seem to know that there is an update available, no matter how many times I run a "gem update" or "gem update --system" or "update_rubygems"
root#server:~# gem install rails -v 2.3.8
ERROR: could not find gem rails locally or in a repository
root#server:~# gem install rails
Successfully installed rails-2.3.5
1 gem installed
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for rails-2.3.5...
RubyGems 1.3.5 is installed.
I don't remember having to do anything special for any of my other servers when making this upgrade.
Any ideas?
Try:
gem install rails --source http://rubygems.org
with --source and without -v.

Resources