创建新的rails项目时出错

时间:2016-07-20 05:56:30

标签: ruby-on-rails ruby ruby-on-rails-4

当我尝试创建一个新的rails项目时,我收到此错误。我从未遇到此错误。

/usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'activesupport' (= 4.2.5) - did find: [activesupport-4.2.4,activesupport-4.2.3,activesupport-4.2.1,activesupport-4.2.0,activesupport-4.1.5,activesupport-4.1.4,activesupport-4.1.1,activesupport-4.0.13,activesupport-4.0.4,activesupport-4.0.0,activesupport-3.2.16,activesupport-3.2.13,activesupport-3.2.11,activesupport-3.2.9,activesupport-3.2.2,activesupport-3.1.3,activesupport-3.0.3] (Gem::LoadError)
Checked in 'GEM_PATH=/home/techbirds/.rvm/gems/ruby-2.2.1:/home/techbirds/.rvm/gems/ruby-2.2.1@global', execute `gem env` for more information
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1311:in `block in activate_dependencies'
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1300:in `each'
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1300:in `activate_dependencies'
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1282:in `activate'
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:67:in `block in gem'
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in `synchronize'
    from /usr/share/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in `gem'
    from /home/techbirds/.rvm/gems/ruby-2.2.1/bin/rails:22:in `<main>'
    from /home/techbirds/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /home/techbirds/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

2 个答案:

答案 0 :(得分:0)

好像你没有安装gem依赖项

Could not find 'activesupport' (= 4.2.5) - did find: [activesupport-4.2.4,activesupport-4.2.3 ..... activesupport-3.0.3] (Gem::LoadError)

在创建新的rails应用程序时指定rails版本

rails _4.2.16_ new my_app # change the version accordingly
# You must have rails 4.2.16 installed 

答案 1 :(得分:0)

好像你收到了这个错误,因为rvm没有使用ruby的更新版本。
运行此命令

  

rvm list
  这将为您提供系统上安装的所有ruby版本以及您的计算机正在使用的ruby版本。然后通过此命令选择最新版本的ruby

rvm use ruby version