Activated Ruby RAKE 10.0.1, require 10.0.0

匿名 (未验证) 提交于 2019-12-03 07:36:14

问题:

I get this error when i try to run "rake test":

avery@ubuntu:~/rails_projects/depot$ rake test rake aborted! You have already activated rake 10.0.1, but your Gemfile requires rake 10.0.0. Using bundle exec may solve this. /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `block in setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/setup.rb:7:in `<top (required)>' /home/avery/rails_projects/depot/config/boot.rb:6:in `<top (required)>' /home/avery/rails_projects/depot/config/application.rb:1:in `<top (required)>' /home/avery/rails_projects/depot/Rakefile:5:in `<top (required)>' (See full trace by running task with --trace) 

when i try running "bundle exec rake" i get:

rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `block (2 levels) in require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:66:in `each' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:66:in `block in require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:55:in `each' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:55:in `require' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler.rb:128:in `require' /home/avery/rails_projects/depot/config/application.rb:7:in `<top (required)>' /home/avery/rails_projects/depot/Rakefile:5:in `require' /home/avery/rails_projects/depot/Rakefile:5:in `<top (required)>' (See full trace by running task with --trace) 

how can i fix this?

回答1:

You probably have rake 10.0.0 in your Gemfile.lock.

Removing Gemfile.lock might solve the problem.



回答2:

For the first part of the question: I ran into the same problem and solved it with a:

gem regenerate_binstubs 

after that

gem -V 

reveals 10.0.0 again.



回答3:

Answer of 1st query

In your Gemfile, explicitly set the latest rake version by

gem 'rake', '~> 10.0.1' 

And then run

$ bundle update rake 

Answer of 2nd query

put this in your Gemfile and run bundle install

gem 'therubyracer' 


回答4:

For the second part of the question, you just need to add this to your Gemfile:

gem 'therubyracer' 


回答5:

If you've specified a rake version in your Gemfile that your project requires, eg:

gem 'rake', '~> 10.0.0' 

Try installing it again

bundle install 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!