cannot load such file -- rack (LoadError)

cevo

Active Member
#1
I got this error in /usr/local/lsws/logs/stderr.log

Code:
2015-01-04 20:04:55.686 [STDERR] /usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rack (LoadError)

from /usr/local/rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'

from /usr/local/lsws/fcgi-bin/RackRunner.rb:13:in `<main>'
gem env
Code:
# gem env

RubyGems Environment:

  - RUBYGEMS VERSION: 2.4.5

  - RUBY VERSION: 2.1.3 (2014-09-19 patchlevel 242) [x86_64-linux]

  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.1.3

  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.1.3/bin/ruby

  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.1.3/bin

  - SPEC CACHE DIRECTORY: /root/.gem/specs

  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.1.3/etc

  - RUBYGEMS PLATFORMS:

    - ruby

    - x86_64-linux

  - GEM PATHS:

    - /usr/local/rvm/gems/ruby-2.1.3

    - /usr/local/rvm/gems/ruby-2.1.3@global

  - GEM CONFIGURATION:

    - :update_sources => true

    - :verbose => true

    - :backtrace => false

    - :bulk_threshold => 1000

  - REMOTE SOURCES:

    - https://rubygems.org/

  - SHELL PATH:

    - /usr/local/rvm/gems/ruby-2.1.3/bin

    - /usr/local/rvm/gems/ruby-2.1.3@global/bin

    - /usr/local/rvm/rubies/ruby-2.1.3/bin

    - /usr/local/sbin

    - /usr/local/bin

    - /usr/sbin

    - /usr/bin

    - /sbin

    - /bin

    - /usr/local/rvm/bin
Anyone know how to fix?
 

cevo

Active Member
#5
Code:
root@server:~# diff  /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.6.0/lib/rack/handler/lsws.rb /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/handler/lsws.rb

30c30

<         env[QUERY_STRING]   ||= ""

---

>         env["QUERY_STRING"] ||= ""
which one I should use?
 

mistwang

LiteSpeed Staff
#6
uses 1.6.0 code is the better bet. but it may not have any effect on this problem.
Maybe you should look into the gemset setup if you use rvm.
 

cevo

Active Member
#7
This is the detail info from "$rvm info"

Code:
root@server:~# rvm info


ruby-2.1.3:


  system:

    uname:       "Linux server.citec.us 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux"

    system:      "ubuntu/14.04/x86_64"

    bash:        "/bin/bash => GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)"

    zsh:         " => not installed"


  rvm:

    version:      "rvm 1.26.7 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"

    updated:      "4 days 11 hours 36 minutes 22 seconds ago"

    path:         "/usr/local/rvm"


  ruby:

    interpreter:  "ruby"

    version:      "2.1.3p242"

    date:         "2014-09-19"

    platform:     "x86_64-linux"

    patchlevel:   "2014-09-19 revision 47630"

    full_version: "ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]"


  homes:

    gem:          "/usr/local/rvm/gems/ruby-2.1.3"

    ruby:         "/usr/local/rvm/rubies/ruby-2.1.3"


  binaries:

    ruby:         "/usr/local/rvm/rubies/ruby-2.1.3/bin/ruby"

    irb:          "/usr/local/rvm/rubies/ruby-2.1.3/bin/irb"

    gem:          "/usr/local/rvm/rubies/ruby-2.1.3/bin/gem"

    rake:         "/usr/local/rvm/gems/ruby-2.1.3/bin/rake"


  environment:

    PATH:         "/usr/local/rvm/gems/ruby-2.1.3/bin:/usr/local/rvm/gems/ruby-2.1.3@global/bin:/usr/local/rvm/rubies/ruby-2.1.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin"

    GEM_HOME:     "/usr/local/rvm/gems/ruby-2.1.3"

    GEM_PATH:     "/usr/local/rvm/gems/ruby-2.1.3:/usr/local/rvm/gems/ruby-2.1.3@global"

    MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.1.3"

    IRBRC:        "/usr/local/rvm/rubies/ruby-2.1.3/.irbrc"

    RUBYOPT:      ""

    gemset:       ""
 

cevo

Active Member
#8
anyone can help? I did the same step with openlitespeed still don't get Ruby on Rail work.
Anyone got experience to get it work ?
 

mistwang

LiteSpeed Staff
#13
use <name>=<value> for environment variable, just like you did from command line, cannot use those values as is.
GEM_HOME=/usr/local/rvm/gems/ruby-2.1.3
GEM_PATH=/usr/local/rvm/gems/ruby-2.1.3:/usr/local/rvm/gems/ruby-2.1.3@global
 

cevo

Active Member
#14
well, actually I have correct the syntax after posted the reply. Even the same syntax as you suggested is still no luck.
 

cevo

Active Member
#16
I would suggest not to use RVM, it is big headache, just install ruby and gem from source, then install rails.
Your idea is like "milk doesn't have a good taste then blame a straw"
Would it be better if u offer me a debug version or way to debug the part of the code which produced this error message "
rack (LoadError) or (LoadError)" then we would know what is cause of the problem.
 

cevo

Active Member
#18
The error is from ruby gem, I think it is that the gem searching path was not set properly.
You can write a simple rack hello world application, see if you can run it.
like http://ruby.about.com/od/rack/a/Using-Rack.htm

RVM is for running multiple version of ruby/rails, if you only use one version, no need to bother.
Not just simple hello word script I can even run the big website project like this successfully.
https://github.com/neighborly/neighborly-donate
https://github.com/catarse/catarse
But, it was run on rail not litespeed.
 
Top