简体   繁体   中英

error while installing jruby using rvm

I can install jruby on cygwin using rvm, but the jruby gems do not get installed and any attempt to install gem fails.

This is the error I get during installation of jruby, when rvm tries to install default gemset:

Building Nailgun  
jruby-1.6.7 - #installing to /home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7  
jruby-1.6.7 - #importing default gemsets (/home/salil.wadnerkar/.rvm/gemsets/)  
Copying across included gems  
cygpath: can't convert empty path  
Error opening script file: C:/cygwin/home/salil.wadnerkar/.rvm/src/jruby-1.6.7/tool/nailgun/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem (The system cannot find the path specified)

Any further attempt to install any gem meets with a similar error:

$ which gem  
/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem  

$ gem install rake  
cygpath: can't convert empty path  
Fetching: rake-0.9.2.2.gem (100%)  
ERROR:  While executing gem ... (Errno::ENOENT)  
    No such file or directory - C:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/cache/rake-0.9.2.2.gem  

Update:

Here is my gem env

$ gem env  
cygpath: can't convert empty path  
RubyGems Environment:  
  - RUBYGEMS VERSION: 1.8.15  
  - RUBY VERSION: 1.9.2 (2012-02-22 patchlevel 312) [java]  
  - INSTALLATION DIRECTORY: /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7  
  - RUBY EXECUTABLE: C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/  
jruby.exe  
  - EXECUTABLE DIRECTORY: /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/bin  
  - RUBYGEMS PLATFORMS:  
    - ruby  
    - universal-java-1.7  
  - GEM PATHS:  
     - /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7  
     - /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7:/home/salil.wadnerkar/.rvm/ge  
ms/jruby-1.6.7@global  
  - GEM CONFIGURATION:  
     - :update_sources => true  
     - :verbose => true  
     - :benchmark => false  
     - :backtrace => false  
     - :bulk_threshold => 1000  
     - "install" => "--no-rdoc --no-ri --env-shebang"  
     - "update" => "--no-rdoc --no-ri --env-shebang"  
  - REMOTE SOURCES:  
     - http://rubygems.org/  

Edit:

Here is my rvm info

$ rvm info  

jruby-1.6.7:  

  system:  
    uname:       "CYGWIN_NT-6.1 got002518 1.7.11(0.260/5/3) 2012-02-24 14:05 i686 Cygwin"  
    bash:        "/usr/bin/bash => GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)"  
    zsh:         " => not installed"  

  rvm:  
    version:      "rvm 1.10.3 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/]"  
    updated:      "18 hours 30 minutes 15 seconds ago"  
cygpath: can't convert empty path  

  ruby:  
    interpreter:  "jruby"  
    version:      "1.6.7"  
    date:         "2012-02-22"  
    platform:     "Windows 7-x86-java"  
    patchlevel:   "TM"  
    full_version: "jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotS"ot(TM) Client VM 1.7.0_03) [Windows 7-x86-java]  

  homes:  
    gem:          "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7"  
    ruby:         "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7"  

  binaries:  
    ruby:         "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/ruby"  
    irb:          "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/irb"  
    gem:          "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem"  
    rake:         "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/rake"  

  environment:  
    PATH:         "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7@global/bin:/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Users/salilw_adm/AppData/Roaming/cabal/bin:/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Hummingbird/Connectivity/14.00/Accessories:/cygdrive/c/Program Files/Hummingbird/Connectivity/14.00/NFS Maestro:/cygdrive/c/Program Files/WindowsLive/Shared:/cygdrive/c/Program Files/Java/jdk1.7.0_03/bin:/cygdrive/c/Python27:/cygdrive/c/Python27/Scripts:/cygdrive/c/Program Files/QuickTi  
me/QTSystem:/cygdrive/c/Program Files/Subversion/bin:/cygdrive/c/apache-ant-1.8.2/bin:/cygdrive/c/Ruby192/bin:/cygdrive/c/Users/salil.wadnerkar/AppData/Roaming/cabal/bin"  
    GEM_HOME:     "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7"  
    GEM_PATH:     "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7@global"  
    MY_RUBY_HOME: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7"  
    IRBRC:        "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/.irbrc"  
    RUBYOPT:      ""  
    gemset:       ""  

I think it has to do something with the way cygwin is using GEMPATH.

$ gem install bundler  
cygpath: can't convert empty path  
Fetching: bundler-1.0.22.gem (100%)  
ERROR:  While executing gem ... (Errno::ENOENT)  
    No such file or directory - C:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/ca  
che/bundler-1.0.22.gem  

$ echo $GEM_PATH  
/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7:/home/salil.wadnerkar/.rvm/gems/jrub  
y-1.6.7@global  

While installing a gem, gem is trying to use Windows-style path. In fact, I have to manually create the gem cache directory because it is using the windows style path and could not find the gem cache directory for gem installation.

Edit: rvm seems to correctly add its path at the front of PATH.

$ echo $PATH  
/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/gems/jruby-  1.6.7@global/bin:/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/bin:/usr/local/bin:/usr/bin:.....  

Edit:

Here is the output of the debug command. I am going to put 'cygpath' in there somewhere to see whether it fixes the path interpretation.

$ gem install rake --debug  
cygpath: can't convert empty path  
ERROR:  While executing gem ... (Errno::ENOENT)  
No such file or directory - C:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/cache/rake-0.9.2.2.gem  
    org/jruby/RubyFile.java:465:in `initialize'  
    org/jruby/RubyIO.java:1135:in `open'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:152:in `download'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:278:in `install'  
    org/jruby/RubyArray.java:1615:in `each'  
    org/jruby/RubyEnumerable.java:956:in `each_with_index'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `install'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:121:in `execute'  
    org/jruby/RubyArray.java:1615:in `each'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `execute'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/command.rb:278:in `invoke'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:147:in `process_args'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:117:in `run'  
    C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:65:in `run'  
    C:\cygwin\home\salil.wadnerkar\.rvm\rubies\jruby-1.6.7\bin\jgem:25:in `(root)'  
Exception `Gem::SystemExitException' at C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/user_interaction.rb:332 - Exiting RubyGems with exit_code 1  
Error opening script file: C:/cygwin/home/salil.wadnerkar/.rvm/src/jruby-1.6.7/tool/nailgun/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem (The system cannot find the path specified)

The path format is your problem. Cygwin doesn't (and shouldn't) recognize paths like that. This same path should have been:

/home/salil.wadnerkar/.rvm/src/jruby-1.6.7/tool/nailgun/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem

Your problem boils down to this -- a tool which is very important for Cygwin, is overriden by another tool with the same name in your PATH system variable, and that tool is located in a directory which is before your Cygwin binary path.

( I had a similar problem when I tried to compile native gems, but I had Windows version of GCC in my PATH and it was before the Cygwin binary path ).

A very quick solution would be to edit your system PATH environment variable and make sure your Cygwin binary path is the first entry there, something like this:

PATH = C:\cygwin\bin;C:\your\other\paths;C:\windows\system32;...

etc.

Of course, exit all your Cygwin consoles and stop any Cygwin program that might still be running, then start consoles/other programs again. Everything should be just fine.

I hope this helps you.

I faced similar issues. I tried everything possible including reinstalling Cygwin. Finally I overcame the issues by building jruby from source.

Further to my previous post - I overcame the issues by building jruby from source via Ant build as mentioned within the README in jruby source bundle. Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM