rake在Rails4中不起作用

时间:2014-05-03 05:35:31

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

我试图在Rails4上使用Ruby,但它没有用。 当我使用在我的mac中首先安装的Ruby时,没有错误。 但在我安装rbenv后,会发生此错误。 我该如何解决这个问题?

$ bundle exec rake assets:precompile
/Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:220: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.3.1 in any of the sources (Bundler::GemNotFound)
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `map!'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `materialize'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/definition.rb:133:in `specs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/definition.rb:178:in `specs_for'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/definition.rb:167:in `requested_specs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/environment.rb:18:in `requested_specs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:13:in `setup'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/setup.rb:17:in `<top (required)>'
from /Users/Fumiya/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Fumiya/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

1 个答案:

答案 0 :(得分:3)

在gemfile中指定

gem 'rake', '10.3.1'

然后

bundle install

并做

bundle exec rake assets:precompile