Linux 无法 gem 安装导轨
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4564408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't gem install rails
提问by Jason Swett
This question has been asked many times before but it seems everyone else is trying it on OS X. I'm on Ubuntu.
这个问题以前被问过很多次,但似乎其他人都在 OS X 上尝试它。我在 Ubuntu 上。
Here's what I get when I try to sudo gem install rails
:
这是我尝试时得到的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 'rails' is currently not installed. To run 'rails' please ask your administrator to install the package 'rails'
采纳答案by Jason Swett
Turns out I needed to do this:
原来我需要这样做:
sudo apt-get install ruby-dev build-essential
回答by vonconrad
It's working, as indicated by the 1 gem installed
line.
它正在工作,如1 gem installed
行所示。
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.orgfor documentation anyway.
您收到的错误消息是因为 Rails 文档不会生成——许多 gem 的自动文档记录功能有类似的问题。这不会损害 gem 的功能,而且您可能会去api.rubyonrails.org获取文档。
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):
如果 Rails 安装实际上失败了,您会看到类似以下内容的内容(可能会有所不同——下面的示例来自可能不同的本机扩展):
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.
如果您选中gem list
,Rails 将在列表中。
回答by ghoppe
Try the following:
请尝试以下操作:
$ gem environment
$ gem 环境
and
和
$ echo $PATH
$回声 $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
)
确保您的可执行目录出现在您的 $PATH 变量中。如果没有,请将其添加到您的 shell 启动文件中。(例如,你的.profile
)
回答by hnprashanth
None of the above solutions worked for me. Installing the latest RubyGems manually & then installing rails worked for me.
以上解决方案都不适合我。手动安装最新的 RubyGems 然后安装 rails 对我有用。
回答by neoneye
I solved it by installing rdoc, like this. However you are on Ubuntu and I'm on Mac.
我通过安装 rdoc 解决了这个问题,就像这样。但是你在 Ubuntu 上,我在 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$
回答by Tommy Chan
I got it to work by installing it with the rails decl:
我通过使用 rails decl 安装它来让它工作:
\curl -L https://get.rvm.io| bash -s stable --rails
\curl -L https://get.rvm.io| bash -s 稳定 --rails