为什么Rubygems无法安装Rails?

5
我正在尝试在我的Ubuntu 12.04上使用命令“gem install rails”安装Rails。我已经在我的apt.conf文件中配置了用户名、密码和代理详细信息。然而,执行此命令时出现以下错误:“ERROR: While executing gem ... (Net::HTTPServerException) 407 "Proxy Authentication Required"”。如果我运行“sudo gem install rails”,则会出现以下错误:“ERROR: While executing gem ... (Gem::DependencyError) Unable to resolve dependencies: treetop requires polyglot (>= 0), polyglot (>= 0.3.1); sprockets requires tilt (!= 1.3.0, ~> 1.1)”。我的本地gem列表如下:
* 本地宝石库 * actionmailer (4.0.1) actionpack (4.0.1) activemodel (4.0.1) activerecord (4.0.1) activerecord-deprecated_finders (1.0.3) activesupport (4.0.1) arel (4.0.1) atomic (1.1.14) bigdecimal (1.2.0) builder (3.1.4) bundler (1.3.5) bundler-unload (1.0.2) coffee-rails (4.0.1) coffee-script (2.2.0) coffee-script-source (1.6.3) erubis (2.7.0) execjs (2.0.2) executable-hooks (1.2.6) hike (1.2.3) i18n (0.6.5) io-console (0.4.2) jbuilder (1.5.2) jquery-rails (3.0.4) json (1.8.1, 1.7.7) mail (2.5.4) mime-types (1.25) minitest (4.7.5, 4.3.2) multi_json (1.8.2) polyglot (0.3.3) psych (2.0.0) rack (1.5.2) rack-test (0.6.2) rails (4.0.1) railties (4.0.1) rake (10.1.0, 0.9.6) rdoc (4.0.1, 4.0.0, 3.12.2) rubygems-bundler (1.4.2) rvm (1.11.3.8) sass (3.2.12) sass-rails (4.0.1) sdoc (0.3.20) sprockets (2.10.0) sprockets-rails (2.0.1) sqlite3 (1.3.8) test-unit (2.0.0.0) thor (0.18.1) thread_safe (0.1.3) tilt (1.4.1) treetop (1.4.15) turbolinks (1.3.0) tzinfo (0.3.38) uglifier (2.3.0)
我已经运行了 "rvm requirements" 命令,我也尝试使用 SET HTTP_PROXY 命令,但似乎并没有任何影响。我该怎么办?
编辑:
我尝试使用
export http_proxy=http://${username}:${password}@${proxy}:${port}
然后运行 gem install rails 就成功了...

尝试一下sudo gem install rails怎么样? - sawa
@sawa:现在显示以下错误: ERROR: 在执行 gem 时...(Gem::DependencyError) 无法解决依赖关系:treetop 需要 polyglot(>=0),polyglot(>=0.3.1); sprockets 需要 tilt(!=1.3.0,~>1.1)。 - Kavish Dwivedi
手动安装依赖项怎么样? - sawa
@sawa:是的,我本来会安装的,但也应该通过gem install进行安装。我在一开始就遇到了麻烦,因为我尝试使用sudo apt-get install rails,结果把一切都搞砸了。而且我不明白,如果我的gem列表中tilt和polyglot版本更新了,为什么还会显示这样的错误? - Kavish Dwivedi
可能是为什么Gems无法安装Rails?的重复问题。 - Litmus
1个回答

1
超级用户和普通用户有不同的宝石列表。 我认为超级用户没有polyglot和tilt。
尝试:
sudo gem install polyglot
sudo gem install tilt

请检查超级用户的宝石列表。
sudo gem list

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接