JRuby 1.7.6 cannot install gems - ruby

I am using RVM and Homebrew on OS X Mavericks. JRuby 1.7.6 installs, but I cannot install any gems. I believe that JRuby comes with a semi-complete version of openssl. I have tried using http for gem sources, and even downloaded the gem for a local install. I see this same error regardless of gem locality or gem source.
$ jruby -S gem install bundler --trace
ERROR: Loading command: install (LoadError)
load error: openssl -- java.lang.IncompatibleClassChangeError: Implementing class
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Others Rubies (1.8.7, 1.9.3, 2.0.0) are working without issue in RVM.

You need to use the ruby first:
rvm use jruby-1.7.6
It will ensure all jruby gems are available for it.

Is there a proxy blocking your access to the gemserver?
jruby -S gem source --add http://rubygems.org?

Related

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.

Why does 'gem update --system' give me an error

I'm going through a server setup guide and I'm trying to download rubygems:
gem update --system
I am on version 2.2.2 of ruby gems, version 2.1.2p95 of ruby, and ubuntu 14.04, but it doesn't appear to be working. Looking further into this, I found an alternative to the command
here on their official site.
However, when I run:
~/ruby-src/ruby-2.1.2$ sudo gem install rubygems-update
I'm still getting the same error which is:
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

Using Rubygems on Debian: Cannot install gems

I seem unable to install any gems. When I try something like sudo gem install rails or sudo gem install rdiscount I get the following errors:
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args` for nil:NilClass
Can anyone please help me figure out the cause of this problem?
It seems this you have not installed all required libs for. the ruby works, either install it for the debian, or use rvm and install ruby version you need with it from sources.

How to install gems over ruby 2?

I just installed ruby 2 on MacMountainLion, how to install gems? Actually I have both installed but there is something wrong. Maybe a fresh installation would solve.
macbook:~m$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
macbook:~ m$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]
macbook:~ m$ gem -v
2.0.3
macbook:~ m$
I had the same problem, but fixed it as follows:
Apparently OS X Mountain Lion has an older version of OpenSSL than Ruby 2 will tolerate. Download and install the latest OpenSSL using ./Configure darwin64-x86_64-cc --prefix=/usr/local --openssldir=/usr/local/openssl; make; sudo make install. Then build Ruby using ./configure --with-openssl-dir=/usr/local/openssl; make; sudo make install. Ruby's configure complains that --with-openssl-dir is an unknown option, but the build apparently uses it anyway because anything that depends on SSL, including gem installs, now works.
Installing gem like rails needs lot of dependent libraries which you have to download and install it manually
Alternatively you can try using Homebrew to install all the dependent libraries. If you are new to ROR development I strongly recommend you to use rvm to manage different versions of ruby
Once you have installed all the necessary dependent libraries using Homebrew then Its fairly straight forward to install a gem, execute the following after replacing "gemname" with the gem you are interested in
gem install <<gemname>>

gem install rails does not work

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.

Resources