简体   繁体   English

宝石不能安装导轨

[英]Can't gem install rails

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'

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. 您获得的错误消息是因为Rails文档不会生成 - 许多gem在其自动记录功能方面存在类似问题。 This won't impair the functionality of the gem, and chances are you'll go to api.rubyonrails.org for documentation anyway. 这不会影响宝石的功能,无论如何你都可以去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将在列表中。

Try the following: 请尝试以下方法:

$ gem environment $ gem环境

and

$ echo $PATH $ echo $ PATH

Ensure that your EXECUTABLE DIRECTORY shows up in your $PATH variable. 确保您的$ PATH变量中显示您的EXECUTABLE DIRECTORY。 If it doesn't, add it in your shell startup files. 如果没有,请将其添加到shell启动文件中。 (eg. your .profile ) (例如你的.profile

I solved it by installing rdoc, like this. 我通过安装rdoc解决了这个问题。 However you are on Ubuntu and I'm on Mac. 但是你在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$

I got it to work by installing it with the rails decl: 我通过使用rails decl安装它来实现它:

\\curl -L https://get.rvm.io | \\ curl -L https://get.rvm.io | bash -s stable --rails bash -s stable --rails

结果我需要这样做:

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. 手动安装最新的RubyGems然后安装rails对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM