ruby 2.3无法运行" rake routes"

时间:2016-01-04 00:13:56

标签: ruby-on-rails ruby rake

我正在使用带有rails 4.2.5的新ruby版本(2.3.0),我正面临着" rake"命令。

编辑:我修改了bin / rake

#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

现在错误是:

➜ rvm:(ruby-2.3.0@rails4.2) git:(edge) ✗ rake routes

./bin/rake:3:in `require': cannot load such file -- rake (LoadError)
    from ./bin/rake:3:in `<main>'

该命令适用于ruby 2.2.4

这是我的宝石文件:

source 'https://rubygems.org'
# ruby '2.3.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'

# Use postgresql as the database for Active Record
gem 'pg', '0.18.3'

gem 'sass-rails', '~> 5.0'
gem 'bootstrap-sass', '~> 3.3.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'

# gem 'therubyracer', platforms: :ruby

gem 'jquery-rails'
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

gem 'paperclip', '~> 4.2.1'

gem 'will_paginate', '3.0.7'

gem 'bootstrap-will_paginate'

gem 'auto_html', '1.6.4'

gem 'faker', '1.1.2'

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

group :development, :test do
  gem 'guard'
  # gem 'guard-livereload'
  # gem 'guard-rspec'
  # gem 'guard-cucumber'
  gem 'rspec-rails'
  gem 'spring-commands-rspec'
  gem 'shoulda-matchers'
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'byebug', '~> 3.5.1'
  gem 'quiet_assets'
  #debug
  gem 'pry-rails'
  gem 'pry-byebug'
  gem 'pry-stack_explorer'
  gem 'pry-rescue'
  gem 'awesome_print'
  gem 'hirb'
end

group :development do
  # A static analysis security vulnerability scanner for Ruby on Rails applications
  gem 'brakeman', :require => false

  # Checks for code optimization.
  gem 'rubycritic', :require => false

  # Checks for undefined routes and unreachable actions.
  gem 'traceroute'

  # Checks for query optimizations.
  gem 'bullet'

  #  Profiler for your development and production Ruby rack apps.
  gem 'rack-mini-profiler', require: false

  # Checks for code optimization.
  gem 'rails_best_practices'

  # Checks for compliance to Sandi Metz's rules for developers.
  gem 'sandi_meter'

  #  A Ruby static code analyzer, based on the community Ruby style guide.
  gem 'rubocop', require: false
end

group :test do
  gem 'capybara', '2.5.0'
  gem 'factory_girl_rails', '4.4.1'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner', '~> 1.4.1'
  gem 'simplecov', :require => false
end

group :production do
  gem 'rails_12factor', '0.0.2'
end

这是我的gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    abstract_type (0.0.7)
    actionmailer (4.2.5)
      actionpack (= 4.2.5)
      actionview (= 4.2.5)
      activejob (= 4.2.5)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.5)
      actionview (= 4.2.5)
      activesupport (= 4.2.5)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.5)
      activesupport (= 4.2.5)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.5)
      activesupport (= 4.2.5)
      globalid (>= 0.3.0)
    activemodel (4.2.5)
      activesupport (= 4.2.5)
      builder (~> 3.1)
    activerecord (4.2.5)
      activemodel (= 4.2.5)
      activesupport (= 4.2.5)
      arel (~> 6.0)
    activesupport (4.2.5)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    adamantium (0.2.0)
      ice_nine (~> 0.11.0)
      memoizable (~> 0.4.0)
    addressable (2.4.0)
    arel (6.0.3)
    ast (2.2.0)
    astrolabe (1.3.1)
      parser (~> 2.2)
    auto_html (1.6.4)
      redcarpet (~> 3.1)
      rinku (~> 1.5.0)
    autoprefixer-rails (6.2.3)
      execjs
      json
    awesome_print (1.6.1)
    axiom-types (0.1.1)
      descendants_tracker (~> 0.0.4)
      ice_nine (~> 0.11.0)
      thread_safe (~> 0.3, >= 0.3.1)
    bcrypt (3.1.10)
    better_errors (2.1.1)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
      rack (>= 0.9.0)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (3.3.6)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap-will_paginate (0.0.10)
      will_paginate
    brakeman (3.1.4)
      erubis (~> 2.6)
      fastercsv (~> 1.5)
      haml (>= 3.0, < 5.0)
      highline (>= 1.6.20, < 2.0)
      multi_json (~> 1.2)
      ruby2ruby (>= 2.1.1, < 2.3.0)
      ruby_parser (~> 3.7.0)
      safe_yaml (>= 1.0)
      sass (~> 3.0)
      slim (>= 1.3.6, < 4.0)
      terminal-table (~> 1.4)
    builder (3.2.2)
    bullet (4.14.10)
      activesupport (>= 3.0.0)
      uniform_notifier (~> 1.9.0)
    byebug (3.5.1)
      columnize (~> 0.8)
      debugger-linecache (~> 1.2)
      slop (~> 3.6)
    capybara (2.5.0)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.8)
      climate_control (>= 0.0.3, < 1.0)
    code_analyzer (0.4.5)
      sexp_processor
    codeclimate-engine-rb (0.1.0)
      virtus (~> 1.0)
    coderay (1.1.0)
    coercible (1.0.0)
      descendants_tracker (~> 0.0.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    colored (1.2)
    columnize (0.9.0)
    concord (0.1.5)
      adamantium (~> 0.2.0)
      equalizer (~> 0.0.9)
    concurrent-ruby (1.0.0)
    cucumber (1.3.20)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.12)
      multi_json (>= 1.7.5, < 2.0)
      multi_test (>= 0.1.2)
    cucumber-rails (1.4.2)
      capybara (>= 1.1.2, < 3)
      cucumber (>= 1.3.8, < 2)
      mime-types (>= 1.16, < 3)
      nokogiri (~> 1.5)
      rails (>= 3, < 5)
    database_cleaner (1.4.1)
    debug_inspector (0.0.2)
    debugger-linecache (1.2.0)
    descendants_tracker (0.0.4)
      thread_safe (~> 0.3, >= 0.3.1)
    diff-lcs (1.2.5)
    docile (1.1.5)
    equalizer (0.0.11)
    erubis (2.7.0)
    execjs (2.6.0)
    factory_girl (4.4.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.4.1)
      factory_girl (~> 4.4.0)
      railties (>= 3.0.0)
    faker (1.1.2)
      i18n (~> 0.5)
    fastercsv (1.5.5)
    ffi (1.9.10)
    flay (2.6.1)
      ruby_parser (~> 3.0)
      sexp_processor (~> 4.0)
    flog (4.3.2)
      ruby_parser (~> 3.1, > 3.1.0)
      sexp_processor (~> 4.4)
    formatador (0.2.5)
    gherkin (2.12.2)
      multi_json (~> 1.3)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    guard (2.13.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, <= 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    haml (4.0.7)
      tilt
    highline (1.7.8)
    hirb (0.7.3)
    i18n (0.7.0)
    ice_nine (0.11.1)
    interception (0.5)
    jbuilder (2.4.0)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.0.5)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    json (1.8.3)
    launchy (2.4.3)
      addressable (~> 2.3)
    listen (3.0.5)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.10)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    memoizable (0.4.2)
      thread_safe (~> 0.3, >= 0.3.1)
    method_source (0.8.2)
    mime-types (2.99)
    mini_portile2 (2.0.0)
    minitest (5.8.3)
    mixlib-cli (1.5.0)
    multi_json (1.11.2)
    multi_test (0.1.2)
    nenv (0.2.0)
    nokogiri (1.6.7.1)
      mini_portile2 (~> 2.0.0.rc2)
    notiffany (0.0.8)
      nenv (~> 0.1)
      shellany (~> 0.0)
    paperclip (4.2.4)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      cocaine (~> 0.5.5)
      mime-types
    parser (2.2.3.0)
      ast (>= 1.1, < 3.0)
    pg (0.18.3)
    powerpack (0.1.1)
    private_attr (1.1.0)
    procto (0.0.2)
    pry (0.10.3)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-byebug (3.0.1)
      byebug (~> 3.4)
      pry (~> 0.10)
    pry-rails (0.3.4)
      pry (>= 0.9.10)
    pry-rescue (1.4.2)
      interception (>= 0.5)
      pry
    pry-stack_explorer (0.4.9.2)
      binding_of_caller (>= 0.7)
      pry (>= 0.9.11)
    quiet_assets (1.1.0)
      railties (>= 3.1, < 5.0)
    rack (1.6.4)
    rack-mini-profiler (0.9.8)
      rack (>= 1.1.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.5)
      actionmailer (= 4.2.5)
      actionpack (= 4.2.5)
      actionview (= 4.2.5)
      activejob (= 4.2.5)
      activemodel (= 4.2.5)
      activerecord (= 4.2.5)
      activesupport (= 4.2.5)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.5)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_best_practices (1.15.7)
      activesupport
      code_analyzer (>= 0.4.3)
      colored
      erubis
      i18n
      json
      require_all
      ruby-progressbar
    rails_serve_static_assets (0.0.4)
    rails_stdout_logging (0.0.4)
    railties (4.2.5)
      actionpack (= 4.2.5)
      activesupport (= 4.2.5)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rainbow (2.0.0)
    rake (10.4.2)
    rb-fsevent (0.9.7)
    rb-inotify (0.9.5)
      ffi (>= 0.5.0)
    rdoc (4.2.1)
      json (~> 1.4)
    redcarpet (3.3.4)
    reek (3.8.1)
      codeclimate-engine-rb (~> 0.1.0)
      parser (~> 2.2, >= 2.2.2.5)
      private_attr (~> 1.1)
      rainbow (~> 2.0)
      unparser (~> 0.2.2)
    require_all (1.3.3)
    rinku (1.5.1)
    rspec-core (3.4.1)
      rspec-support (~> 3.4.0)
    rspec-expectations (3.4.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-mocks (3.4.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-rails (3.4.0)
      actionpack (>= 3.0, < 4.3)
      activesupport (>= 3.0, < 4.3)
      railties (>= 3.0, < 4.3)
      rspec-core (~> 3.4.0)
      rspec-expectations (~> 3.4.0)
      rspec-mocks (~> 3.4.0)
      rspec-support (~> 3.4.0)
    rspec-support (3.4.1)
    rubocop (0.35.1)
      astrolabe (~> 1.3)
      parser (>= 2.2.3.0, < 3.0)
      powerpack (~> 0.1)
      rainbow (>= 1.99.1, < 3.0)
      ruby-progressbar (~> 1.7)
      tins (<= 1.6.0)
    ruby-progressbar (1.7.5)
    ruby2ruby (2.2.0)
      ruby_parser (~> 3.1)
      sexp_processor (~> 4.0)
    ruby_parser (3.7.2)
      sexp_processor (~> 4.1)
    rubycritic (2.4.1)
      flay (= 2.6.1)
      flog (= 4.3.2)
      parser (>= 2.2.0, < 3.0)
      reek (= 3.8.1)
      virtus (~> 1.0)
    safe_yaml (1.0.4)
    sandi_meter (1.2.0)
      json
      launchy
      mixlib-cli
    sass (3.4.20)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    sexp_processor (4.6.0)
    shellany (0.0.1)
    shoulda-matchers (3.0.1)
      activesupport (>= 4.0.0)
    simplecov (0.11.1)
      docile (~> 1.1.0)
      json (~> 1.8)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    slim (3.0.6)
      temple (~> 0.7.3)
      tilt (>= 1.3.3, < 2.1)
    slop (3.6.0)
    spring (1.6.1)
    spring-commands-rspec (1.0.4)
      spring (>= 0.9.1)
    sprockets (3.5.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    temple (0.7.6)
    terminal-table (1.5.2)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.1)
    tins (1.6.0)
    traceroute (0.5.0)
      rails (>= 3.0.0)
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (2.7.2)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    uniform_notifier (1.9.0)
    unparser (0.2.4)
      abstract_type (~> 0.0.7)
      adamantium (~> 0.2.0)
      concord (~> 0.1.5)
      diff-lcs (~> 1.2.5)
      equalizer (~> 0.0.9)
      parser (~> 2.2.2)
      procto (~> 0.0.2)
    virtus (1.0.5)
      axiom-types (~> 0.1)
      coercible (~> 1.0)
      descendants_tracker (~> 0.0, >= 0.0.3)
      equalizer (~> 0.0, >= 0.0.9)
    will_paginate (3.0.7)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  auto_html (= 1.6.4)
  awesome_print
  bcrypt (~> 3.1.7)
  better_errors
  binding_of_caller
  bootstrap-sass (~> 3.3.0)
  bootstrap-will_paginate
  brakeman
  bullet
  byebug (~> 3.5.1)
  capybara (= 2.5.0)
  coffee-rails (~> 4.1.0)
  cucumber-rails
  database_cleaner (~> 1.4.1)
  factory_girl_rails (= 4.4.1)
  faker (= 1.1.2)
  guard
  hirb
  jbuilder (~> 2.0)
  jquery-rails
  paperclip (~> 4.2.1)
  pg (= 0.18.3)
  pry-byebug
  pry-rails
  pry-rescue
  pry-stack_explorer
  quiet_assets
  rack-mini-profiler
  rails (= 4.2.5)
  rails_12factor (= 0.0.2)
  rails_best_practices
  rspec-rails
  rubocop
  rubycritic
  sandi_meter
  sass-rails (~> 5.0)
  sdoc
  shoulda-matchers
  simplecov
  spring
  spring-commands-rspec
  traceroute
  turbolinks
  uglifier (>= 1.3.0)
  will_paginate (= 3.0.7)

BUNDLED WITH
   1.11.2

提前致谢。

3 个答案:

答案 0 :(得分:3)

重新安装Ruby对我有帮助。使用 RVM ,您可以输入

rvm reinstall ruby-2.3.0

在控制台上。

答案 1 :(得分:0)

1: bundle exec rake install

2: bundle exec rake routes

希望这能帮到你!!!

如果您仍然有问题,那么follow this

答案 2 :(得分:0)

我卸载然后重新安装2.3.0,这就是解决方案。