This question has been asked many times before but it seems everyone else is trying it on OS X. I'm on Ubuntu.
Here's what I get when I try to sudo gem install rails
:
$ sudo gem install rails
Successfully installed rails-3.0.3
1 gem installed
Installing ri documentation for rails-3.0.3...
file 'lib' not found
Installing RDoc documentation for rails-3.0.3...
file 'lib' not found
What do I have to do to get it to work?
I know it's not working because of this:
$ rails
The program 'rail开发者_如何学JAVAs' is currently not installed. To run 'rails' please ask your administrator to install the package 'rails'
Try the following:
$ gem environment
and
$ echo $PATH
Ensure that your EXECUTABLE DIRECTORY shows up in your $PATH variable. If it doesn't, add it in your shell startup files. (eg. your .profile
)
It's working, as indicated by the 1 gem installed
line.
The error messages you're getting is because the Rails documentation won't generate--many gems have similar problems with their auto-documenting feature. This won't impair the functionality of the gem, and chances are you'll go to api.rubyonrails.org for documentation anyway.
If the Rails installation actually failed, you'd see something along the lines of (might vary--the example below is from a native extension which may differ):
ERROR: Error installing rails:
[stacktrace]
Gem files will remain installed in /path/to/Ruby/Gems/1.8/gems/rails-3.0.3 for inspection.
Results logged to /path/to/Ruby/Gems/1.8/gems/rails-3.0.3/ext/gem_make.out
If you check gem list
, Rails will be in the list.
I solved it by installing rdoc, like this. However you are on Ubuntu and I'm on Mac.
Simon-Strandgaards-Mac-mini:Desktop neoneye$ gem install rails
Fetching: i18n-0.6.0.gem (100%)
Fetching: multi_json-1.1.0.gem (100%)
Fetching: activesupport-3.2.1.gem (100%)
...
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for railties-3.2.1...
Installing RDoc documentation for bundler-1.0.22...
Installing RDoc documentation for rails-3.2.1...
file 'lib' not found
Simon-Strandgaards-Mac-mini:Desktop neoneye$ gem install rdoc
Fetching: rdoc-3.12.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed rdoc-3.12
1 gem installed
Installing ri documentation for rdoc-3.12...
Installing RDoc documentation for rdoc-3.12...
Simon-Strandgaards-Mac-mini:Desktop neoneye$ gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
Simon-Strandgaards-Mac-mini:Desktop neoneye$
I got it to work by installing it with the rails decl:
\curl -L https://get.rvm.io | bash -s stable --rails
Turns out I needed to do this:
sudo apt-get install ruby-dev build-essential
None of the above solutions worked for me. Installing the latest RubyGems manually & then installing rails worked for me.
精彩评论