2016-01-16 33 views
4

我試圖在rails 4.2中安裝rake gem。 釷寶石似乎安裝正常,但然後Rails嘗試運行時失敗,說它不能看到rake-10.5.0。 我正在開發魯米賽,我得到的錯誤在下面,我的Gemfile也是如此。 我試圖刪除Gemfile.lock建議其他職位,但無濟於事。Rails找不到Rake-10.5.0

控制檯:

~/Development/RubymineProjects/Revenant.tech  
ls 
Gemfile  Rakefile config  lib  test 
Gemfile.lock app  config.ru log  tmp 
README.rdoc bin  db  public  vendor 
~/Development/RubymineProjects/Revenant.tech  
gem install rack 
Successfully installed rack-1.6.4 
Parsing documentation for rack-1.6.4 
Done installing documentation for rack after 2 seconds 
1 gem installed 
~/Development/RubymineProjects/Revenant.tech  
bundle update rake 
Fetching gem metadata from https://rubygems.org/........... 
Fetching version metadata from https://rubygems.org/... 
Fetching dependency metadata from https://rubygems.org/.. 
Resolving dependencies... 
Using rake 10.5.0 
Using i18n 0.7.0 
Using json 1.8.3 
Using minitest 5.8.3 
Using thread_safe 0.3.5 
Using builder 3.2.2 
Using erubis 2.7.0 
Using mini_portile2 2.0.0 
Using rack 1.6.4 
Using mime-types 2.99 
Using arel 6.0.3 
Using debug_inspector 0.0.2 
Using bundler 1.11.2 
Using byebug 8.2.1 
Using coffee-script-source 1.10.0 
Using execjs 2.6.0 
Using thor 0.19.1 
Using concurrent-ruby 1.0.0 
Using multi_json 1.11.2 
Using mysql2 0.4.2 
Using sass 3.4.21 
Using tilt 2.0.2 
Using spring 1.6.2 
Using tzinfo 1.2.2 
Using nokogiri 1.6.7.1 
Using rack-test 0.6.3 
Using mail 2.6.3 
Using binding_of_caller 0.7.2 
Using coffee-script 2.4.1 
Using uglifier 2.7.2 
Using sprockets 3.5.2 
Using activesupport 4.2.5 
Using loofah 2.0.3 
Using rails-deprecated_sanitizer 1.0.3 
Using globalid 0.3.6 
Using activemodel 4.2.5 
Using jbuilder 2.4.0 
Using rails-html-sanitizer 1.0.2 
Using rails-dom-testing 1.0.7 
Using activejob 4.2.5 
Using activerecord 4.2.5 
Using actionview 4.2.5 
Using actionpack 4.2.5 
Using actionmailer 4.2.5 
Using railties 4.2.5 
Using sprockets-rails 3.0.0 
Using coffee-rails 4.1.1 
Using jquery-rails 4.1.0 
Using rails 4.2.5 
Using sass-rails 5.0.4 
Using web-console 2.2.1 
Using turbolinks 2.5.3 
Bundle updated! 
~/Development/RubymineProjects/Revenant.tech  
rm Gemfile.lock 
~/Development/RubymineProjects/Revenant.tech  
bundle install 
Fetching gem metadata from https://rubygems.org/........... 
Fetching version metadata from https://rubygems.org/... 
Fetching dependency metadata from https://rubygems.org/.. 
Resolving dependencies..... 
Using rake 10.5.0 
Using i18n 0.7.0 
Using json 1.8.3 
Using minitest 5.8.3 
Using thread_safe 0.3.5 
Using builder 3.2.2 
Using erubis 2.7.0 
Using mini_portile2 2.0.0 
Using rack 1.6.4 
Using mime-types 2.99 
Using arel 6.0.3 
Using debug_inspector 0.0.2 
Using bundler 1.11.2 
Using byebug 8.2.1 
Using coffee-script-source 1.10.0 
Using execjs 2.6.0 
Using thor 0.19.1 
Using concurrent-ruby 1.0.0 
Using multi_json 1.11.2 
Using mysql2 0.4.2 
Using sass 3.4.21 
Using tilt 2.0.2 
Using spring 1.6.2 
Using tzinfo 1.2.2 
Using nokogiri 1.6.7.1 
Using rack-test 0.6.3 
Using mail 2.6.3 
Using binding_of_caller 0.7.2 
Using coffee-script 2.4.1 
Using uglifier 2.7.2 
Using sprockets 3.5.2 
Using activesupport 4.2.5 
Using loofah 2.0.3 
Using rails-deprecated_sanitizer 1.0.3 
Using globalid 0.3.6 
Using activemodel 4.2.5 
Using jbuilder 2.4.0 
Using rails-html-sanitizer 1.0.2 
Using rails-dom-testing 1.0.7 
Using activejob 4.2.5 
Using activerecord 4.2.5 
Using actionview 4.2.5 
Using actionpack 4.2.5 
Using actionmailer 4.2.5 
Using railties 4.2.5 
Using sprockets-rails 3.0.0 
Using coffee-rails 4.1.1 
Using jquery-rails 4.1.0 
Using rails 4.2.5 
Using sass-rails 5.0.4 
Using web-console 2.2.1 
Using turbolinks 2.5.3 
Bundle complete! 12 Gemfile dependencies, 52 gems now installed. 
Use `bundle show [gemname]` to see where a bundled gem is installed. 
~/Development/RubymineProjects/Revenant.tech  

RubyMine的控制檯錯誤:

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/richardcurteis/Development/RubymineProjects/Revenant.tech/bin/rails server -b 0.0.0.0 -p 3000 -e development 
/Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/spec_set.rb:94:in `block in materialize': Could not find rake-10.5.0 in any of the sources (Bundler::GemNotFound) 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `map!' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/spec_set.rb:87:in `materialize' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/definition.rb:137:in `specs' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/definition.rb:182:in `specs_for' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/definition.rb:171:in `requested_specs' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/environment.rb:18:in `requested_specs' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:13:in `setup' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup' 
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require' 
    from /Users/richardcurteis/Development/RubymineProjects/Revenant.tech/config/boot.rb:3:in `<top (required)>' 
    from /Users/richardcurteis/Development/RubymineProjects/Revenant.tech/bin/rails:3:in `require_relative' 
    from /Users/richardcurteis/Development/RubymineProjects/Revenant.tech/bin/rails:3:in `<top (required)>' 
    from -e:1:in `load' 
    from -e:1:in `<main>' 

Process finished with exit code 1 

Rake文件:

source 'https://rubygems.org' 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.5' 
# Use mysql as the database for Active Record 
gem 'mysql2', '>= 0.3.13', '< 0.5' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

gem 'rake' 

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

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

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

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 

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

實際上,您不需要在'gemfile'中包含'gem'rake''。嘗試刪除這個字符串並刪除'gemfile.lock'一個,'gem install rake --version = '10 .5.0''和'bundle install' –

+0

刪除gemfile.lock的問題是你可以無意間拉入不同的寶石版本比你在prod/staging環境中使用的版本要多。此外,如果該步驟作爲部署的一部分運行,則依靠gem install來獲取「正確」版本的rake僅適用於其他環境。 – jaydel

回答

1

耙的名單,我相信這個問題是我的Ruby安裝做。 我跑到下面的命令,這似乎已經解決了這個問題

rvm install ruby-2.0.0-p643 
rvm --default use 2.0.0 
ruby -v 
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-darwin14.1.0] 
+1

只是一個頭像,ruby 2.0.0不再是最新版本。 '警告:請注意,您剛剛安裝了不再維護的紅寶石(2016-02-24),有關維護的紅寶石列表,請訪問:' 'http://bugs.ruby-lang。 org/projects/ruby​​/wiki/ReleaseEngineering' '請考慮升級到ruby-2.3.0,它將包含所有最新的安全修補程序。' 因此,現在安裝更新的版本會更好。 – FedericoCapaldo

1

我覺得耙的多個版本安裝在您的系統,。因此,要啓動該應用程序使用

bundle exec rails s -p 3000 

您檢查安裝在您的系統gem list | grep rake

+1

我在Gemfile中添加了'gem'rake','10.5.0',但我仍然得到相同的錯誤。 –

+1

我有同樣的問題; @Sasidaran如何檢查耙安裝(假設我的環境中有多個)? –

+0

你可以通過'gem list rake'來查看本地gemset中的所有rake版本。你也可以做'bundle show | grep rake'來查看與捆綁器相關的安裝版本,以防出現某種斷開連接的情況。 – jaydel

0

搜索耙在Gemfile.lock的,並更新到您的使用耙版本。然後運行bundle,問題應該修復

+0

如上所述,問題在於我使用的Ruby版本。 –