rails 1.9.3`to_specs':找不到栏杆Gem:加载错误

时间:2014-04-18 06:50:53

标签: ruby-on-rails ruby gem webserver

我得到以下错误。

rails -v
/opt/ruby/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find      railties (>= 0) amongst [daemons-1.1.9, diff-lcs-1.1.3, expectations-2.0.0, faraday-0.8.9, faraday_middleware-0.8.8, ftpfxp-0.0.4, json-1.7.7, json-1.6.1, json-1.4.3, lumberg-1.1.1, metaclass-0.0.1, mime-types-1.24, mocha-0.12.7, multipart-post-1.2.0, mysql-2.8.1, rest-client-1.6.7, rspec-2.11.0, rspec-core-2.11.1, rspec-expectations-2.11.3, rspec-mocks-2.11.3, stomp-1.2.2, system_timer-1.2.4, systemu-1.2.0] (Gem::LoadError)
    from /opt/ruby/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /opt/ruby/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /home/adsudxuy/ruby/gems/bin/rails:22:in `<main>'

我的Gemrc文件如下:

cat .gemrc
---
gem: --remote --gen-rdoc --run-tests
gemhome: /home/adsudxuy/ruby/gems
gempath: [/opt/ruby/lib/ruby/gems/1.9.1,
      /home/adsudxuy/ruby/gems]
rdoc: --inline-source --line-numbers

我的bash个人资料如下:     #开始     #.bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

#PATH=$PATH:$HOME/bin
PATH=$HOME/.gems/bin:$HOME/bin:$PATH

GEM_HOME=$HOME/.gems
GEM_PATH=$HOME/.gems:/usr/lib/ruby/gems/1.8

export PATH GEM_HOME GEM_PATH

#export PATH
#END

另外,供您参考,我的宝石环境如下:

gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-05-15 patchlevel 429) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/user_name/ruby/gems
- RUBY EXECUTABLE: /opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /home/user_name/ruby/gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
 - /home/user_name/ruby/gems
 - /opt/ruby/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :benchmark => false
 - :backtrace => false
 - :bulk_threshold => 1000
 - "gem" => "--remote --gen-rdoc --run-tests"
 - "gemhome" => "/home/user_name/ruby/gems"
 - "gempath" => ["/opt/ruby/lib/ruby/gems/1.9.1", "/home/user_name/ruby/gems"]
 - "rdoc" => "--inline-source --line-numbers"
 - REMOTE SOURCES:
 - http://rubygems.org/

请建议我有什么问题以及如何纠正错误。 在此先感谢。

2 个答案:

答案 0 :(得分:7)

尝试观察 railties gem的路径:

bundle show railties

如果失败,请尝试手动安装gem:

gem install railties

答案 1 :(得分:2)

尝试安装通用ruby版本:

sudo apt-get install ruby-dev

然后尝试,

sudo gem install railties