Ruby Gems Won't Load Even Though Installed

Ruby gems won't load even though installed

Your gem env and Gem.path are inconsistent.


Your Gem.path is looking at ["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"] but your gem env is looking at /opt/ruby1.9/lib/ruby/gems/1.9.1

As a quick check, why not create a symlink from /opt/ruby1.9/lib/ruby/gems/1.9.1
to /opt/ruby1.9/lib/ruby1.9/gems/1.9.1 to /opt/ruby1.9/lib/ruby/gems/1.9.1

sudo ln -s /opt/ruby1.9/lib/ruby1.9/gems/1.9.1  /opt/ruby1.9/lib/ruby/gems/1.9.1

Ruby gem listed, but won't load (gem in user dir, not ruby dir)

I had the same problem, I fixed it by adding the following at the top of the ruby file

require 'rubygems'

Hope that helps

Ruby gems not being loaded

Thanks very much to Josh and grenierm5 for their time and advice - RBENV was a great help, definitely makes life easier.

The answer is two-part: RBENV to solve my weird environment issues, but then also to solve the mysql gem install issue, I had to install the following Debian packages:

apt-get install mysql-client libmysqlclient-dev

This was answered here: ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3)

rubygems-bundler gem load error on capistrano deploy

Okay, was able to solve my own problem. Turns out rubygems-bundler is not what I thought it was and had accidentally installed it in a previously attempt to solve another problem.

I solved this issue by:

rubygems-bundler-uninstaller
gem uninstall rubygems-bundler
rvm all-gemsets do gem uninstall --all --executables rubygems-bundler

No idea what caused it, but i was able to deploy just fine afterwards.

Hope that helps someone else!

JRuby won't install gems in correct path

After trying out for days, I used the bundle config documentation which says to use bundle config list to view the set configs.

Through this, I found that the bundler had set a path for where the gems should be installed.

After deleting the config, everything seems to work normally as it should!

Ruby extension wrapper around C library fails to load installed library

Running ldconfig /usr/local/lib as root turns out to be the answer. It causes the loader to be able to locate the installed libdavenport.so.0 library at runtime.

To the follow-on questions, the answer is that the make install probably won't be able to eliminate the need to run ldconfig on some systems. There is an old issue against another library that made the attempt, still open, at
esnet/iperf. They didn't figure it out. If they did, they didn't update the issue. A newer issue against
libcheck/check has similar struggles.

The current Gnu documentation for libtool has open in its
implementation issues,

The install Makefile target should warn the package installer to set
the proper environment variables (LD_LIBRARY_PATH or equivalent), or
run ldconfig.

The "solution" in this case, is a documentation solution for the Davenport library,
an update to the README made with
this PR.

There's a nice short explanation about library linking and loading at
Cprogramming.com (which is ad' supported but not painfully so; the article earns the reference).

Unable to gem install nokogiri

I think the answer was staring us in the face, your version of nokogiri requires Ruby less than 2.3, and you're running ruby 2.3.

It seems you're not the only one with this issue: https://github.com/sparklemotion/nokogiri/issues/1456

gem server won't serve gems

I solved this pretty easily.

I don't even use a dedicated gem server.

I did the following:

  1. Create a directory on your apache web server that is servable and create a gems subdir in it. For example:
    mkdir -p /var/www/rubygems/gems

  2. Put all gems you want to serve to the created gems subdirectory: cp /my/gems/dir/*.gem /var/www/rubygems/gems

  3. Generate the gem index:
    gem generate_index -d /var/www/rubygems

  4. Do not forget to adapt the access rights so that your web server can read the contents

INFO: The index has to be generated in the directory that contains the gems subdir, not the gems dir itself! In this case it's /var/www/rubygems.

Now you can add http://<my-gem-server>.domain/rubygems to your gem sources



Related Topics



Leave a reply



Submit