javascript - Rails:找不到 JavaScript 运行时。有关可用运行时的列表,请参阅 https://github.com/sstephenson/execjs。 (ExecJS::RuntimeUnavailable)

标签 javascript ruby-on-rails ruby-on-rails-3.1 v8 dreamhost

自从 Dreamhost 几周前升级了他们的服务器后,我的网站就出现了故障。我一直在竭尽全力试图修复它并取得了一些进展,但我仍然停留在希望是最后一期的问题上。

我在 Ruby 1.8.7 上使用 Rails 3.1.1,PhusionPassenger 提示“Ruby (Rack) 应用程序无法启动错误”。它声明它“找不到 JavaScript 运行时”。参见 https://github.com/sstephenson/execjs获取可用运行时列表。 (ExecJS::RuntimeUnavailable)'。在 Dreamhost 的 wiki 上搜索这个建议了一个安装“therubyracer”gem 的解决方案。

所以我用建议的 gem 更新了我的 gemfile,如下所示:

gem 'therubyracer', '~> 0.9.9'

编辑:我也尝试添加到文件中:

gem 'therubyracer', :platforms => :ruby

但这并没有什么不同。

然后在我的 Macbook(运行 OS X 10.5.8)上顺利安装了捆绑软件。但是,当我运行“cap deploy”以安装 Dreamhost 时,这失败了;当它尝试安装 therubyracer 所依赖的 libv8 时,我看到一个错误。

有人知道如何正确安装它或任何其他有效的解决方案吗?

可应要求提供任何其他信息。

来自终端的完整错误反馈:

  • executing "cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703 && bundle install --gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile --path /home/futureproof/.gems/bundle --deployment --quiet --without development test" servers: ["abunchofletters.co.uk"] [abunchofletters.co.uk] executing command ** [out :: abunchofletters.co.uk] Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks! ** [out :: abunchofletters.co.uk] /usr/lib/ruby/1.8/rubygems/installer.rb:483:in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] /usr/bin/ruby1.8 extconf.rb ** [out :: abunchofletters.co.uk] *** extconf.rb failed *** ** [out :: abunchofletters.co.uk] Could not create Makefile due to some reason, probably lack of ** [out :: abunchofletters.co.uk] necessary libraries and/or headers. Check the mkmf.log file for more ** [out :: abunchofletters.co.uk] details. You may need configuration options. ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] Provided configuration options: ** [out :: abunchofletters.co.uk] --with-opt-dir ** [out :: abunchofletters.co.uk] --without-opt-dir ** [out :: abunchofletters.co.uk] --with-opt-include ** [out :: abunchofletters.co.uk] --without-opt-include=${opt-dir}/include ** [out :: abunchofletters.co.uk] --with-opt-lib ** [out :: abunchofletters.co.uk] --without-opt-lib=${opt-dir}/lib ** [out :: abunchofletters.co.uk] --with-make-prog ** [out :: abunchofletters.co.uk] --without-make-prog ** [out :: abunchofletters.co.uk] --srcdir=. ** [out :: abunchofletters.co.uk] --curdir ** [out :: abunchofletters.co.uk] --ruby=/usr/bin/ruby1.8 ** [out :: abunchofletters.co.uk] extconf.rb:13: uninitialized constant Gem (NameError) ** [out :: abunchofletters.co.uk] Checking for Python... ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] Gem files will remain installed in /home/futureproof/.gems/bundle/ruby/1.8/gems/libv8-3.3.10.4 for inspection. ** [out :: abunchofletters.co.uk] Results logged to /home/futureproof/.gems/bundle/ruby/1.8/gems/libv8-3.3.10.4/ext/libv8/gem_make.out ** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:446:ineach' ** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:446:in build_extensions' ** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:198:ininstall' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/source.rb:90:in install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:78:in preserve_paths' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/source.rb:89:in install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:73:in install_gem_from_spec' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:93:in with_build_args' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:72:in install_gem_from_spec' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:56:in run' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in run' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:12:in install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:in install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in send' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in run' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocation.rb:118:in invoke_task' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263:in dispatch' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/base.rb:386:in start' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/bin/bundle:13 ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/bin/bundle:19:in load' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/bin/bundle:19 command finished in 13170ms *** [deploy:update_code] rolling back * executing "rm -rf /home/futureproof/abunchofletters.co.uk/releases/20111118003703; true" servers: ["abunchofletters.co.uk"] [abunchofletters.co.uk] executing command command finished in 563ms failed: "sh -c 'cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703 && bundle install --gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile --path /home/futureproof/.gems/bundle --deployment --quiet --without development test'" on abunchofletters.co.uk

最佳答案

如果你使用的是 Ubuntu,请安装 nodejs

sudo apt-get install nodejs

关于javascript - Rails:找不到 JavaScript 运行时。有关可用运行时的列表,请参阅 https://github.com/sstephenson/execjs。 (ExecJS::RuntimeUnavailable),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8059332/

相关文章:

javascript函数使元素垂直居中

javascript - 引导日期选择器验证不起作用

ruby-on-rails - rails + 载波 : How to link to file?

ruby-on-rails - 在 Rails 测试套件中使用工厂的优点和缺点?

ruby-on-rails - 蓝图 CSS、Ruby on Rails 3.1 和 "CSS conditions"

javascript - 从链接列表中,单击时将单击的链接设为第一个

ruby-on-rails - 将 ActiveRecord 查询作为变量返回,而不是散列?

ruby-on-rails-3.1 - Rails 3.1.3 和继承资源测试失败

jQuery $(document).ready 不是一个函数 - Rails 3.1

javascript - 从 html 输入中获取值