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

新手上路,请多包涵

自从 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,如下所示:

宝石 ‘therubyracer’, ‘~> 0.9.9’

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

宝石 ‘therubyracer’, :platforms => :ruby

但这并没有什么不同。

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

任何人都知道如何让它正确安装或任何其他工作解决方案?

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

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

  • 执行“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] 不幸的是,一个致命错误已经发生了。请将此错误报告给 https://github.com/carlhuda/bundler/issues 上的 Bundler 问题跟踪器,以便我们修复它。谢谢! ** [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:in 每个’ \*\* [out :: abunchofletters.co.uk ] 来自 /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:in 安装’ \*\* [out :: abunchofletters.co.uk] 来自 /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] 来自 /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] 来自 /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] 来自 /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 安装’ \*\* [out :: abunchofletters.co.uk] 来自 /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]来自/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] 来自 /home/futureproof/.gems/bin/bundle:19 命令在 13170 毫秒内完成 *** [deploy:update_code] 回滚 * 执行“rm -rf /home/futureproof/abunchofletters.co.uk/releases/ 20111118003703;真”服务器:[“abunchofletters.co.uk”] [abunchofletters.co.uk] 执行命令命令在 563 毫秒内完成失败:“sh -c ‘cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703 && bundle在 abunchofletters.co 上安装 –gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile –path /home/futureproof/.gems/bundle –deployment –quiet –without development test’“。英国

原文由 Rich 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 380
2 个回答

libv8 是操作系统库;您需要安装正确的 Linux 系统库。如果你运行的是 Ubuntu,它是

sudo apt-get install libv8-dev

或者,您可以安装 node.js 它可以作为各种发行版的 Debian/Ubuntu 软件包使用,例如 http://ppa.launchpad.net/chris-lea/node.js/ubuntu

通过在 Heroku 上部署而不是在不必管理 Gems 的操作系统或组件的地方,您可以为自己省去很多麻烦。

原文由 Wolfram Arnold 发布,翻译遵循 CC BY-SA 3.0 许可协议

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

 sudo apt-get install nodejs

原文由 Jim Clouse 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏