安装了铁路但未找到

时间:2013-01-03 07:13:39

标签: ruby-on-rails ruby

使用这个SO回答How do you use multiple rails versions with rbenv?,我试图使用rbenv(而不是rvm)来设置一个环境来管理不同版本的Ruby和Rails。答案首先说是以这种方式安装链接到ruby版本的Rails版本。

RBENV_VERSION=1.9.3-p327 rbenv exec gem install rails --version 3.2.10

这对我有用。安装了Rails。

按照其说明,我尝试使用该版本的rails

以这种方式创建一个新项目
RBENV_VERSION=1.9.3-p327 rbenv exec rails _3.10.2_ new newprojectname

这对我没有用。我收到有关

的错误消息
.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (= 3.10.2) amongst [RedCloth-4.2.9, aaronh-chronic-0.3.9, abstract-1.0.0, actionmailer-3.2.10, actionmailer-3.0.4, actionpack-3.2.10, actionpack-3.0.4, activemodel-3.2.10, activemodel-3.2.9, activemodel-3.0.4, activerecord-3.2.10, activerecord-3.0.4, activeresource-3.2.10, activeresource-3.0.4, activesupport-3.2.10, activesupport-3.2.9, activesupport-3.0.4, addressable-2.3.2, arel-3.0.2, arel-2.0.10, bigdecimal-1.1.0, builder-3.0.4, builder-2.1.2, bundler-1.2.3, capybara-2.0.2, carrierwave-0.5.8, childprocess-0.3.6, coderay-1.0.8, cucumber-1.2.1, cucumber-rails-1.3.0, diff-lcs-1.1.3, erubis-2.7.0, erubis-2.6.6, factory_girl-4.1.0, ffi-1.2.0, formtastic-2.2.1, gherkin-2.11.5, hike-1.2.1, i18n-0.6.1, io-console-0.3, jist-1.3.1, journey-1.0.4, json-1.7.6, json-1.5.4, lesstile-1.1.0, libwebsocket-0.1.7.1, mail-2.4.4, mail-2.2.19, market_beat-0.2.0, method_source-0.8.1, mime-types-1.19, minitest-2.5.1, multi_json-1.5.0, nokogiri-1.5.6, polyglot-0.3.3, pry-0.9.10, pry-rails-0.2.2, rack-1.4.1, rack-1.2.5, rack-cache-1.2, rack-mount-0.6.14, rack-openid-1.3.1, rack-ssl-1.3.2, rack-test-0.6.2, rack-test-0.5.7, rails-3.2.10, rails-3.0.4, railties-3.2.10, railties-3.0.4, rake-10.0.3, rake-0.9.2.2, rdoc-3.9.4, rspec-2.12.0, rspec-core-2.12.2, rspec-expectations-2.12.1, rspec-mocks-2.12.1, rspec-rails-2.12.0, ruby-openid-2.2.2, rubygems-update-1.8.24, rubyzip-0.9.9, selenium-webdriver-2.27.2, slop-3.3.3, sprockets-2.2.2, sqlite3-1.3.6, sqlite3-ruby-1.3.3, thor-0.14.6, tilt-1.3.3, treetop-1.4.12, tzinfo-0.3.35, webrat-0.7.3, websocket-1.0.6, will_paginate-3.0.pre2, xpath-1.0.0] (Gem::LoadError)
    from /Users/michaeljohnmitchell/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/michaeljohnmitchell/.rbenv/versions/1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /Users/michaeljohnmitchell/.rbenv/versions/1.9.3-p327/bin/rails:22:in `<main>'

因此我尝试安装铁路

gem install railties

有效

Successfully installed railties-3.2.10
1 gem installed
Installing ri documentation for railties-3.2.10...
Installing RDoc documentation for railties-3.2.10...

但是,尝试再次创建项目

RBENV_VERSION=1.9.3-p327 rbenv exec rails _3.10.2_ new newprojectname

创建了关于railties的相同错误消息

see error message above

我甚至尝试再次安装铁路,但使用RBENV前缀

RBENV_VERSION=1.9.3-p327 rbenv exec gem install railties

它再次安装!但是,当我尝试创建新项目时,我收到了相同的错误消息。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,

这就是我所做的 我删除了〜/ .gemrc

接下来,我跑了gem env
看它是否指向正确的地方:
RubyGems环境:
   - RUBYGEMS版本:2.0.3
   - RUBY VERSION:2.0.0(2013-02-08 patchlevel -1)[x86_64-linux]
   - 安装目录:/home/[yourpath]/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0
   - RUBY EXECUTABLE:/home/[yourpath]/.rbenv/versions/2.0.0-rc2/bin/ruby
   - 可执行目录:/home/[yourpath]/.rbenv/versions/2.0.0-rc2/bin
   - RUBYGEMS PLATFORMS:
     - 红宝石
     - x86_64-linux
   - 创业板路径:
      - /home/[yourpath]/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0
      - /home/[yourpath]/.gem/ruby/2.0.0    - 创业板配置:
      - :update_sources =&gt;真正
      - :verbose =&gt;真正
      - :backtrace =&gt;假
      - :bulk_threshold =&gt; 1000
   - 远程来源:
      - https://rubygems.org/

然后我试图再次安装宝石

  

gem install rails

现在安装到正确的地方:)
如果它适用于你,请告诉我