Rails,rake不起作用

时间:2011-09-11 02:49:17

标签: ruby-on-rails unix ruby-on-rails-3.1 ubuntu-10.04

我一直在尝试使用Rails,当我使用rake时,我得到了这个错误。我应该使用哪些运行时间的建议?

ngzhongqin@ngzhongqin-linux:~/RailsProjects/webuiltit$ rake db:create:all --trace
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.4/lib/execjs/runtimes.rb:45:in `autodetect'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.4/lib/execjs.rb:5:in `<module:ExecJS>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.4/lib/execjs.rb:4:in `<top (required)>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/coffee-rails-3.1.0/lib/coffee-rails.rb:1:in `require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/coffee-rails-3.1.0/lib/coffee-rails.rb:1:in `<top (required)>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
/home/ngzhongqin/RailsProjects/webuiltit/config/application.rb:13:in `<top (required)>'
/home/ngzhongqin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/ngzhongqin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/ngzhongqin/RailsProjects/webuiltit/Rakefile:5:in `<top (required)>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/ngzhongqin/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'

3 个答案:

答案 0 :(得分:31)

将此添加到您的Gemfile

gem 'therubyracer', require: "v8"

并运行

bundle install

答案 1 :(得分:11)

我已经安装了宝石therubyracer,execjs,野马,但没有任何效果。

在我的linux(ubuntu)命令

sudo apt-get install nodejs

终于为我做了这份工作。

这篇文章可能也会有所帮助:https://github.com/intridea/rails_wizard/issues/31

答案 2 :(得分:0)

您需要为这些安装运行时..一些好的选项是

therubyracer - Google V8 embedded within Ruby

therubyrhino - Mozilla Rhino embedded within JRuby

Johnson - Mozilla SpiderMonkey embedded within Ruby

Mustang - Mustang V8 embedded within Ruby

Node.js

Apple JavaScriptCore - Included with Mac OS X

Mozilla SpiderMonkey

Microsoft Windows Script Host (JScript)

您可以在https://github.com/sstephenson/execjs

找到更多详情