宝石环境未正确设置

时间:2015-03-13 13:45:38

标签: ruby-on-rails ruby

我正在尝试创建一个新的rails应用程序,当我尝试“rails new ...”时出现以下错误。

/Users/david12/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 14 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/david12/.rvm/gems/ruby-2.0.0-p598:/Users/david12/.rvm/gems/ruby-2.0.0-p598@global', execute `gem env` for more information
    from /Users/david12/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/david12/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /usr/bin/rails:22:in `<main>'

我正在使用RVM,我相信我已经在安装中收集了一些东西。这是我的宝石环境的输出:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.6
  - RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-darwin14.1.0]
  - INSTALLATION DIRECTORY: /Users/david12/.rvm/gems/ruby-2.0.0-p598
  - RUBY EXECUTABLE: /Users/david12/.rvm/rubies/ruby-2.0.0-p598/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/david12/.rvm/gems/ruby-2.0.0-p598/bin
  - SPEC CACHE DIRECTORY: /Users/david12/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/david12/.rvm/rubies/ruby-2.0.0-p598/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598/bin
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598@global/bin
     - /Users/david12/.rvm/rubies/ruby-2.0.0-p598/bin
     - /Users/david12/.rvm/bin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
Michael-Davidsons-MacBook-Pro:Rails david12$ rails new test
/Users/david12/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 14 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/david12/.rvm/gems/ruby-2.0.0-p598:/Users/david12/.rvm/gems/ruby-2.0.0-p598@global', execute `gem env` for more information
    from /Users/david12/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/david12/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /usr/bin/rails:22:in `<main>'
Michael-Davidsons-MacBook-Pro:Rails david12$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.6
  - RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-darwin14.1.0]
  - INSTALLATION DIRECTORY: /Users/david12/.rvm/gems/ruby-2.0.0-p598
  - RUBY EXECUTABLE: /Users/david12/.rvm/rubies/ruby-2.0.0-p598/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/david12/.rvm/gems/ruby-2.0.0-p598/bin
  - SPEC CACHE DIRECTORY: /Users/david12/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/david12/.rvm/rubies/ruby-2.0.0-p598/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598/bin
     - /Users/david12/.rvm/gems/ruby-2.0.0-p598@global/bin
     - /Users/david12/.rvm/rubies/ruby-2.0.0-p598/bin
     - /Users/david12/.rvm/bin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

此外,如果它有助于我的路径:

/Users/david12/.rvm/gems/ruby-2.0.0-p598/bin:/Users/david12/.rvm/gems/ruby-2.0.0-p598@global/bin:/Users/david12/.rvm/rubies/ruby-2.0.0-p598/bin:/Users/david12/.rvm/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

关于什么是什么的想法?

1 个答案:

答案 0 :(得分:1)

运行命令

gem install rails

一次。它将下载并安装缺少的依赖项,包括铁路。