问题
I am get below error.
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>'
My Gemrc file is as follows :
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
My bash profile is as follows: #start # .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
Also, for your reference, my gem env is as follows:
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/
Please suggest what is wrong and how shouild i correct it. Thanks in Advance.
回答1:
Try to observe the path to railties gem:
bundle show railties
If it is failed, try to install the gem manually:
gem install railties
回答2:
Try install generic ruby version :
sudo apt-get install ruby-dev
and then try,
sudo gem install railties
来源:https://stackoverflow.com/questions/23148951/rails-1-9-3-to-specs-could-not-find-railties-gemload-error