Rails 3在启动服务器时获取消息ExecJS :: RuntimeUnavailable

时间:2013-06-23 02:24:53

标签: ruby-on-rails startup

日志

administrator@ixery1:/rails_projects/test2$ rails server
/usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /rails_projects/test2/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:53:in `require'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /usr/local/rvm/gems/ruby-1.9.3-p429@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platform => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'execjs'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

真诚地感谢任何帮助。谢谢,格雷格。

编辑不允许我发布它,是否有某处我可以将文件邮寄到请? 谢谢 格雷格

1 个答案:

答案 0 :(得分:0)

取消注释Gemfile中的这一行并运行bundle进行安装:

gem 'therubyracer', :platform => :ruby

<强>更新

删除rvm:

rvm implode

使用本教程安装它:

http://www.andrehonsberg.com/article/install-rvm-ubuntu-1204-linux-for-ruby-193