LoadError: no such file to load; specified gemset not used?

120 views
Skip to first unread message

ruud144

unread,
May 30, 2013, 4:06:36 AM5/30/13
to RVM (Ruby Version Manager)
hi list,

I use rvm for some time, but once in a while I encounter unexplainable
problems. I hope you can help me on this one. I use zsh. My problem is
that jruby seems to be unable to locate a gem while it is installed.

I have tried to create a short and complete example showing the
problem. I hope one of you can tell me what I am overlooking.
This output shows the problem:

$ mkdir rvm
$ cd rvm
$ echo "rvm use jruby-1.6.5" > .rvmrc
$ echo "rvm jruby-1.6.5@rvm" >> .rvmrc
$ cd /tmp; cd -
~/rvm
==============================================================================
=
NOTICE
=
==============================================================================
= RVM has encountered a new or modified .rvmrc file in the current
directory =
= This is a shell script and therefore may contain any shell
commands. =
=
=
= Examine the contents of this file carefully to be sure the contents
are =
= safe before trusting it! ( Choose v[iew] below to view the
contents ) =
==============================================================================
Do you wish to trust this .rvmrc file? (/export/home/rdgon/rvm/.rvmrc)
y[es], n[o], v[iew], c[ancel]> yes
Using /export/home/rdgon/.rvm/gems/jruby-1.6.5
ERROR: Gemset 'rvm' does not exist, rvm gemset create 'rvm' first.
WARN: Gemset doesn't exist, proceeding with default gemset
Using /export/home/rdgon/.rvm/gems/jruby-1.6.5
$ rvm gemset create 'rvm'
'rvm' gemset created (/export/home/rdgon/.rvm/gems/jruby-1.6.5@rvm).

$ echo "source 'https://rubygems.org'" > Gemfile
$ echo "gem( 'net-sftp', '2.1.2')" >> Gemfile
$ cd /tmp; cd -
Now using system ruby.
~/rvm
Using /export/home/rdgon/.rvm/gems/jruby-1.6.5
Using /export/home/rdgon/.rvm/gems/jruby-1.6.5 with gemset rvm

$ which bundle
/export/home/rdgon/.rvm/gems/jruby-1.6.5/bin/bundle
$ bundle install
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Installing net-ssh (2.6.7)
Installing net-sftp (2.1.2)
Using bundler (1.3.1)
Your bundle is complete! Use `bundle show [gemname]` to see where a
bundled gem is installed.
$ bundle show net-sftp
/export/home/rdgon/.rvm/gems/jruby-1.6.5@rvm/gems/net-sftp-2.1.2
$ echo "require 'net/sftp'" > tester
$ which jruby
/export/home/rdgon/.rvm/rubies/jruby-1.6.5/bin/jruby
$ jruby tester
LoadError: no such file to load -- net/sftp
require at org/jruby/RubyKernel.java:1038
(root) at tester:1
zsh: exit 1 jruby tester



As you can see the net-sftp gem IS installed but I keep getting the
'no such file to load' message, and this happens too if I do not make
use of a gemset, but install the gem in the jruby-1.6.5 directory
itself.
I found out that if I do exactly the same but not using jruby-1.6.5,
but ruby-1.9.2 instead, it works without problem. Maybe it is
unrelated to rvm?

thanks in advance, Ruud

mpapis

unread,
Jun 3, 2013, 2:12:45 AM6/3/13
to rubyversi...@googlegroups.com
maybe you have JRUBY_HOME set or other environment variable?

ruud144

unread,
Jun 3, 2013, 4:29:07 AM6/3/13
to RVM (Ruby Version Manager)
On Jun 3, 8:12 am, mpapis <mpa...@gmail.com> wrote:
> maybe you have JRUBY_HOME set or other environment variable?
>

hello mpapis,

not that I am aware of, below is an extract of my environment settings
in the shell.
Looks all right to me. What I find strange is that $GEM_PATH is very
clear about the location. I have tried a symlink in het gemsdirectory
to net-sftp-2.1.2 named net-sftp. That made no difference. The
LoadError stayed the same.

regards, Ruud


$ set
......
GEM_HOME=/export/home/rdgon/.rvm/gems/jruby-1.6.5@rvm
GEM_PATH=/export/home/rdgon/.rvm/gems/jruby-1.6.5@rvm:/export/home/
rdgon/.rvm/gems/jruby-1.6.5@global
.........
IRBRC=/export/home/rdgon/.rvm/rubies/jruby-1.6.5/.irbrc
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
KEYBOARD_HACK=''
.........
MY_RUBY_HOME=/export/home/rdgon/.rvm/rubies/jruby-1.6.5
...........
PATH=/export/home/rdgon/.rvm/gems/jruby-1.6.5@rvm/bin:/export/home/
rdgon/.rvm/gems/jruby-1.6.5@global/bin:/export/home/rdgon/.rvm/rubies/
jruby-1.6.5/bin:/export/home/rdgon/.rvm/bin:.:/usr/local/bin:/bin:/usr/
bin:/usr/X11R6:/usr/X11R6/bin:/export/home/rdgon/bin:/usr/local/
cvsutils/bin:/export/home/rdgon/cvs/util:/usr/lib/jruby/bin
...........
RUBY_VERSION=jruby-1.6.5
.....................
after_cd_hook=/export/home/rdgon/.rvm/hooks/after_cd_bundler
after_cd_hooks=(/export/home/rdgon/.rvm/hooks/after_cd_bundler)
after_use_hook=/export/home/rdgon/.rvm/hooks/after_use_jruby
after_use_hooks=(/export/home/rdgon/.rvm/hooks/after_use_jruby)
....................
chpwd_functions=(__rvm_do_with_env_before __rvm_project_rvmrc
__rvm_after_cd __rvm_do_with_env_after)
commands
.................
hook=/export/home/rdgon/.rvm/hooks/after_cd
........
rvm_alias_expanded=''
rvm_archflags=''
rvm_archive_extension=tar.gz
rvm_bin_flag=''
rvm_bin_path=/export/home/rdgon/.rvm/bin
rvm_clang_flag=0
rvm_configure_flags=''
rvm_create_default_wrappers=0
rvm_current_rvmrc=/export/home/rdgon/rvm/.rvmrc
rvm_debug_flag=0
rvm_delete_flag=0
rvm_docs_type=''
rvm_dump_environment_flag=0
rvm_env_string=jruby-1.6.5@rvm
rvm_file_name=''
rvm_gemdir_flag=''
rvm_gemstone_package_file=''
rvm_gemstone_url=''
rvm_hooks_path=/export/home/rdgon/.rvm/hooks
rvm_ignore_rvmrc=0
rvm_install_args=''
rvm_install_on_use_flag=''
rvm_make_flags=''
rvm_niceness=''
rvm_nightly_flag=''
rvm_only_path_flag=''
rvm_patch_names=''
rvm_patch_original_pwd=''
rvm_path=/export/home/rdgon/.rvm
rvm_prefix=/export/home/rdgon
rvm_pretty_print_flag=''
rvm_previous_environment=ruby-1.9.2-p290@rvm
rvm_project_rvmrc=1
rvm_proxy=''
rvm_quiet_flag=''
rvm_ree_options=''
rvm_reload_flag=0
rvm_remove_flag=''
rvm_ruby_alias=''
rvm_ruby_aliases=''
rvm_ruby_bits=''
rvm_ruby_configure=''
rvm_ruby_file=''
rvm_ruby_global_gems_path=/export/home/rdgon/.rvm/gems/
jruby-1.6.5@global
rvm_ruby_make=''
rvm_ruby_make_install=''
rvm_ruby_mode=''
rvm_ruby_patch=''
rvm_ruby_sha=''
rvm_ruby_string=jruby-1.6.5
rvm_ruby_url=http://jruby.org.s3.amazonaws.com/downloads/1.6.5/jruby-
bin-1.6.5.tar.gz
rvm_ruby_user_tag=''
rvm_rubygems_path=/export/home/rdgon/.rvm/rubygems
rvm_rvmrc_flag=0
rvm_script_name=''
rvm_sdk=''
rvm_silent_flag=''
rvm_sticky_flag=1
rvm_system_flag=''
rvm_use_flag=''
rvm_user_flag=''
rvm_verbose_flag=1
rvm_version=1.10.0-pre
rvm_wrapper_name=''
rvmrc=/export/home/rdgon/.rvmrc

ruud144

unread,
Jun 5, 2013, 9:58:54 AM6/5/13
to rubyversi...@googlegroups.com


On Thursday, May 30, 2013 10:06:36 AM UTC+2, ruud144 wrote:
$ jruby tester
LoadError: no such file to load -- net/sftp
  require at org/jruby/RubyKernel.java:1038
   (root) at tester:1
zsh: exit 1     jruby tester

Hi group,
is it possible that the combination jruby/rvm leads to this kind of problems? I encounter this LoadError for most of the installed gems. For example a simple sinatra script fails with this message too:

$cat kna.rb
require 'sinatra'    
get '/' do
        redirect '/index'
end

$ruby ../utils/kna.rb
LoadError: no such file to load -- sinatra
  require at org/jruby/RubyKernel.java:1038
   (root) at ../utils/kana.rb:1
zsh: exit 1     ruby ../utils/kana.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- sinatra (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from kana.rb:3:in `<main>'
zsh: exit 1     ruby kana.rb

$ bundle show sinatra
Resolving dependencies...
/export/home/rdgon/.rvm/gems/jruby-1.6.5@xslt3/gems/sinatra-1.4.2

regards, Ruud

mpapis

unread,
Jun 8, 2013, 3:52:38 AM6/8/13
to rubyversi...@googlegroups.com
the only thing I found in the output so far is very old rvm => rvm_version=1.10.0-pre

the current version is 1.20.13 - please update rvm, reinstall ruby, and try again
Reply all
Reply to author
Forward
Message has been deleted
0 new messages