gem install rails does not work - ruby

I am working on ubuntu and rvm. In any case I tried to use sudo gem (any command) it does not recognize gem as command. In addition if I use gem seperately as:
gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: Possible alternatives: rails
I got that error. I cannot see the reason.
rvm version 1.10.3
ruby version 1.8.7
gem version 1.6.7
What is the possible reason behind this?

Re-install all rvm and ruby and the gems, solved my problem.

Related

Rvm version error

I have installed many flavors of ruby on rvm, and using following command to change rvm ruby versions.
rvm use 1.9.3
then ruby -v gives me following result
ruby 1.9.3p551 (2014-11-13 revision 48407) [i686-linux]
but when i try to run any commands like rails s or bundle install
it gives me following error
Your Ruby version is 2.3.1, but your Gemfile specified 1.9.3
Using
rvm list
you can get list of ruby version on your system along with current & default versions.
If ruby version is not specified in Gemfile, then it is generally considering default rvm version.
But if it is specified in Gemfile, then that version of ruby should be installed in your system along with its bundler.
First make sure ruby version either installing or using it,
rvm install '1.9.3'
rvm use '1.9.3'
To install bundle of required ruby version, run this command
gem install bundler
That's can happens, when you trying to use fresh installed ruby without bundler, all newest installed ruby should also include bundler installation.
$> rvm use 1.9.3 && gem install bundler # may terminal reload needed
$> bundle install
$> bundle exec rails s

How to install capistrano v2.13.5 with ruby 1.8.7?

I am using ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin14]. When I try to install the capistrano gem I get the following error:
sudo gem install capistrano -v2.13.5
ERROR: Error installing capistrano:
net-ssh requires Ruby version >= 2.0.
AFAIK capistrano 2.13.5 should be compatible with ruby 1.8.7
How can I install capistrano v2.13.5 with ruby 1.8.7 (<2.0) installed?
I have sorted this problem out manually installing the capistrano dependencies. Execute the following commands if you have the same problem:
sudo gem install net-sftp -v2.0.0
sudo gem install net-scp -v1.0.0
sudo gem install net-ssh-gateway -v1.1.0
sudo gem install capistrano -v2.13.5
I had the same error message when installing Capifony in Ubuntu 14.04.
I did this:
# gem install net-ssh -v 2.9.2
And then this:
# gem install capifony
It worked.
I found the solution described here.
Even after installing the dependancies the capistrano installation process was asking for net-ssh that required ruby >= 2.
I had to download the source that I wanted from https://github.com/capistrano/capistrano/releases. Unzip, cd into the directory, and run:
gem build capistrano.gemspec
gem install --local capistrano-2.15.5.gem
Capistrano is trying to install latest version of its dependency (net-ssh) which is not compatible with ruby versions prior v2.0. The solution is to install proper version of that dependency prior to installing capistrano. Proper version means the dependency is compatible with both Ruby and capistrano. In this case that is net-ssh v 2.6.5. So following sequence works:
gem install net-ssh -v 2.6.5
gem install capistrano -v 2.13.5

github-pages gem failing even though I have Ruby version 2.1.2

I'm trying to install github pages gem on my Mac OS X (yosemite).
I get following error:
Gem::InstallError: github-pages requires Ruby version ~> 2.0.0.
An error occurred while installing github-pages (4), and Bundler cannot continue.
Make sure that `gem install github-pages -v '4'` succeeds before bundling.
I checked my Ruby version by running following command -
ruby --version
And it says
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
So I definitely have Ruby version ~> 2.0.0
Any assistance on this issue would be greatly appreciated!
There is a possible lack of important information here. Looking at your Ruby version, are you using rbenv or rvm?
I could imagine this happening if you use rbenv or rvm and then su or sudo to gem install github-pages. rbenv and rvm are specific to your user account and your shell environment. If you su or sudo to root, rbenv and rvm are no longer active.
The other possibility is that you are running it inside of a Bundler managed app that specifies another Ruby version in the Gemfile using the ruby x.x.x syntax.
If neither of these is the case, try running gem env to see what exactly rubygems thinks the story is. Also post the exact commands you are using to get this error.

Could not find gem 'logstash-devutils (>= 0) ruby' in any of the gem sources

I'm just trying to learn to write the example-output-plugin,follow this page:
http://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html#_clone_and_test_4
when I type the "bundle install" in the folder ~/logstash-output-example,I get the the error:
Could not find gem 'logstash-devutils (>= 0) ruby' in any of the gem sources
listed in your Gemfile or installed on this machine.
it seems the gem 'logstash-devutils (>= 0) ruby' missed,but when I type the
"sudo gem install logstash-devutils", I get the error
ERROR: Could not find a valid gem 'logstash-devutils' (>= 0)
Here is why:
Found logstash-devutils (0.0.12), but was for platform java
Anyone else can help me?
environment:MAC OSX 10.9.5
I just ran into the same problem. Solved it by just downloading the gem via the download link on its rubygems.org page and installing it with:
sudo gem install logstash-devutils-0.0.13-java.gem
That worked for me.
Update:
Well, that will install the gem but it will not solve the real problem. I needed to switch to jruby for the tutorial to work. This can be done via the RVM:
sudo rvm install jruby
I tried installing the gem manually and got a different error:
There was a RuntimeError while loading logstash-devutils.gemspec:
Only JRuby is supported from
/Users/bnewton/.rvm/gems/ruby-2.2.1/bundler/gems/logstash-devutils-15c59bfaab59/logstash-devutils.gemspec:2:in `'
This leads me to believe the logstash-devutils requires jruby rather than the usual ruby. I use rvm, so it was a matter of installing and using jruby instead of regular ruby. So if you are using rvm, run:
rvm install jruby-1.7.19
rvm use jruby-1.7.19
gem install bundler
bundle install
This fixed it for me, and I was able to run bundle install without error.

ruby-debug-base19-0.11.26 installation errror

I'm trying to get ruby-debug working with ruby 1.9.3 and rails on OSX Lion.
I've been following http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug , but my problem is I can't get ruby-debug-base19-0.11.26.gem
In my .Gemfile for sources i have
source 'http://rubygems.org'
source :rubyforge
source 'http://gems.rubyforge.org'
when I do
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby- include=/Users/minadoroudi/.rvm/rubies/ruby-1.9.3-p0/include=/Users/me/.rvm/rubies/ruby-1.9.3-p0/
or
gem install ruby-debug-base19-0.11.26 -- --with-ruby- include=/Users/me/.rvm/rubies/ruby-1.9.3-p0/
I get:
ERROR: Could not find a valid gem 'ruby-debug-base19-0.11.26.gem' (>= 0) in any repository
0ERROR: Possible alternatives: ruby-debug-base19, ruby-debug-base19x
Looks like it doesn't pick rubyforge, any ideas?
You need to type gem install ruby-debug-base19 to install the latest version of ruby-debug-base-19.
If you absolutely need to have version 0.11.26, use the v switch, like so:
gem install ruby-debug-base19 -v 0.11.26

Resources