2

Ruby アプリを作成していますが、プログラムを起動するときに大量の gem が必要です。元:

require "active_record"
require "RedCloth"
require "rchardet"
require "mailfactory"
require "net/smtp"

ただし、レールをインストールし、次のように上に置いてリストsudo gem install rails --version=2.1.1に追加しようとすると:railsrequire "rails"

require "rails"
require "active_record"
require "RedCloth"
require "rchardet"
require "mailfactory"
require "net/smtp"

私のアプリは次の行で壊れます: /usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:51:in `gem_original_require': no such file to load -- rails (LoadError)

gem listRailsを実行すると、そこにあります:

    emai@myserver:/usr/local/www/sl-exchange$ gem list

    *** LOCAL GEMS ***

    actionmailer (2.1.1)
    actionpack (2.1.1)
    activemodel (3.2.13)
    activerecord (3.2.13, 2.1.1)
    activerecord-odbc-adapter (2.0)
    activerecord-sqlserver-adapter (3.2.11)
    activeresource (2.1.1)
    activesupport (3.2.13, 2.1.1)
    arel (3.0.2)
    atomic (1.1.10)
    builder (3.0.4)
    daemons (1.0.10)
    i18n (0.6.4, 0.6.1)
    mailfactory (1.4.0)
    mime-types (1.23)
    minitest (4.7.5)
    multi_json (1.7.7)
    pg (0.15.1)
    rack (0.4.0)
    rails (2.1.1)
    rake (10.1.0)
    rchardet (1.3.1)
    RedCloth (4.0.4)
    rubygems-update (2.0.5)
    thread_safe (0.1.0)
    tzinfo (0.3.37)

そして、私がチェックするとgem env

emai@vpc-db:/usr/local/www/sl-exchange$ gem env

    emai@vpc-db:/usr/local/www/sl-exchange$ gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 2.0.5
      - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
      - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
      - RUBY EXECUTABLE: /usr/bin/ruby1.8
      - EXECUTABLE DIRECTORY: /usr/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-linux
      - GEM PATHS:
         - /usr/lib/ruby/gems/1.8
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - https://rubygems.org/

GEM_PATH /usr/lib/ruby/gems/1.8 に移動して、次のことを行いますls

    emai@myserver:/usr/local/www/sl-exchange$ cd /usr/lib/ruby/gems/1.8
    emai@myserver:/usr/lib/ruby/gems/1.8$ ls
    build_info  cache  doc  gems  specifications
    emai@myserver:/usr/lib/ruby/gems/1.8$ cd gems
    emai@myserver:/usr/lib/ruby/gems/1.8/gems$ ls
    actionmailer-2.1.1             arel-3.0.2     pg-0.15.1
    actionpack-2.1.1               atomic-1.1.10      rack-0.4.0
    activemodel-3.2.13             builder-3.0.4      rails-2.1.1
    activerecord-2.1.1             daemons-1.0.10     rake-10.1.0
    activerecord-3.2.13            i18n-0.6.1     rchardet-1.3.1
    activerecord-odbc-adapter-2.0          i18n-0.6.4     RedCloth-4.0.4
    activerecord-sqlserver-adapter-3.2.11  mailfactory-1.4.0  rubygems-update-2.0.5
    activeresource-2.1.1               mime-types-1.23    thread_safe-0.1.0
    activesupport-2.1.1            minitest-4.7.5     tzinfo-0.3.37
    activesupport-3.2.13               multi_json-1.7.7

そこにレールが!誰か何が起こっているのか知っていますか??

4

0 に答える 0