我試圖在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
實際上,您不需要在'gemfile'中包含'gem'rake''。嘗試刪除這個字符串並刪除'gemfile.lock'一個,'gem install rake --version = '10 .5.0''和'bundle install' –
刪除gemfile.lock的問題是你可以無意間拉入不同的寶石版本比你在prod/staging環境中使用的版本要多。此外,如果該步驟作爲部署的一部分運行,則依靠gem install來獲取「正確」版本的rake僅適用於其他環境。 – jaydel