在Centos 6.3上运行'rails s'时,我得到一个'找不到JavaScript运行时'。错误

时间:2013-01-31 21:42:43

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 centos javascript

我搜索了互联网和stackoverflow的答案,但没有一个答案适合我,我无法将nodejs安装到我的服务器上。

我正在使用Rails 3.2.3,Ruby 1.9.3p374。

当我运行'bundle install'和'bundle update'时,我没有收到任何错误。

运行'rails s'后出现错误:

/home/Nameo0/.rvm/gems/ruby-1.9.3-p374@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 /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /home/Nameo0/rails_projects/first_app/config/application.rb:7:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:53:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:53:in `block in <top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@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>'

以下是我安装的宝石:

actionmailer (3.2.3)
actionpack (3.2.11, 3.2.3)
activemodel (3.2.11, 3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.11, 3.2.3)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.2.0, 2.0.1)
json (1.7.6)
libv8 (3.11.8.13 x86_64-linux)
mail (2.4.4)
mime-types (1.19)
multi_json (1.5.0)
polyglot (0.3.3)
rack (1.4.4)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.3)
railties (3.2.3)
rake (10.0.3)
rdoc (3.12)
ref (1.0.2)
rubygems-bundler (1.1.0)
rubygems-update (1.8.24)
rvm (1.11.3.6)
sass (3.2.5)
sass-rails (3.2.6, 3.2.4)
sprockets (2.2.2, 2.1.3)
sqlite3 (1.3.7, 1.3.5)
therubyracer (0.11.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
uglifier (1.3.0, 1.2.3)

1 个答案:

答案 0 :(得分:5)

我通过打开gem文件并添加以下行来修复此问题:

gem "therubyracer", :require => 'v8'

希望能帮助任何有此问题的人。