找不到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的维基search这个提议了一个解决scheme来安装'therubyracer'的gem。

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

gem'therubyracer','〜> 0.9.9'

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

gem'therubyracer',:平台=>:ruby

但没有什么区别。

然后捆绑安装在我的Macbook(运行OS X 10.5.8)没有困难。 但是,当我运行'cap deploy'放在Dreamhost上时,失败了。 当它试图安装therubyracer所依赖的libv8时,我看到一个错误。

任何人都知道如何得到这个安装正确或任何其他工作的解决scheme?

任何其他信息可以根据要求提供。

terminal的完整错误反馈:

  • 执行“cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703 && bundle install –gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile –path /home/futureproof/.gems/捆绑 – 部署 – 安静 – 没有开发testing“服务器:[”abunchofletters.co.uk“] [abunchofletters.co.uk]执行命令** [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 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 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每个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]”中的[abunchofletters.co.uk] /installer.rb:446:in build_extensions' ** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:198:in install'** [out :: abunchofletters 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] bundler-1.1.rc / lib / bundler / source.rb:89: install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:73:in / home / futureproof中的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] /.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]安装程序run' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in :56: run' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:inrun' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in '** [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 / home / futureproof /.gems/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:从/ home安装'** [out :: abunchofletters.co.uk]。 /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运行'** [out :: abunchofletters.co.uk] from / home / futureproof / .gems / gems / bundler-1.1.rc / lib / bundler / vendor / thor / invocation.rb:118:来自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: 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命令在13170ms完成*** [deploy:update_code]回滚*执行“rm -rf /home/futureproof/abunchofletters.co.uk/releases/20111118003703; 真正的“服务器:[”abunchofletters.co.uk“] [abunchofletters.co.uk]执行命令命令在563ms完成失败:”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'“。联合王国

libv8是一个操作系统库; 你需要安装正确的Linux系统库。 如果你正在运行Ubuntu,那就是

 sudo apt-get install libv8-dev 

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

您可以通过在Heroku上部署,而不必pipe理操作系统或组件的gem,节省很多麻烦。

如果你在Ubuntu上,安装nodejs

 sudo apt-get install nodejs 

我使用Dreamhost的这个gem和资产pipe道的Rails 3.1

 group :assets do gem 'execjs' gem 'therubyracer', :platforms => :ruby gem 'johnson' gem 'sass-rails', " ~> 3.1.0" gem 'coffee-rails', "~> 3.1.0" gem 'uglifier' end 

therubyracer作为预编译器,johnson作为运行时。

这个工作对我来说是由Dreamhost托pipe的2个Rails 3.1应用程序。

我在Dreamhost共享服务器。

我不使用root / sudo来安装nodejs。 在服务器上:

 #download node js (check last version from web) $ wget http://nodejs.org/dist/v0.8.16/node-v0.8.16-linux-x86.tar.gz #untar $ tar xzf node-v0.8.16-linux-x86.tar.gz 

Finnaly将其path添加到deploy.rb,添加以下行(在这种情况下添加了一些更多的path):

 default_environment["PATH"] = ":/home/myUser/soft/node-v0.8.16-linux-x86/bin:/home/myUser/.gems/bin:/usr/lib/ruby/gems/1.8/bin/:$PATH" 

你完成了

我只是看到了这个介绍。

到目前为止,我已经使用rubytheracer。 显然它不是很好。 而且这是巨大的。

但是你可以使用任何的JavaScript运行时。

另外两个build议是execjs和node.js (现在非常热)。

确保gem install所选的gem,然后为您的应用bundle installbundle update

还有一点需要注意的是,你也应该切换到1.9.2。
安装RVM (bash <<(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )),你可以同时拥有1.8.7和1.9.2 。

我在Win7开发机器上遇到了同样的问题。 它看起来像安装https://github.com/hiranpeiris/therubyracer_for_windows和;gem 'therubyracer'添加到Gemfilesorting事情。

之前:

 $ rails generate c:/Ruby193/lib/ruby/gems/1.9.1/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 c:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>' (...) 

这基本上意味着Rails需要rubyracerlibv8

后:

 $ rails generate SECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended that you provide a secret to prevent exploits that may be possible from crafted cookies. This will not be supported in future versions of Rack, and future versions will even invalidate your existing user cookies. Called from: c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'. Usage: rails generate GENERATOR [args] [options] (...) 

我会build议安装Nodejs 。 它为我工作。

只要去你的terminal,input:

sudo apt-get install node.js

input您的密码…然后在需要确认时按“Y”。 我希望这有帮助 !!!

在Gemfile中添加以下gem,并尝试使用bundle安装

gem“therubyracer”,“〜> 0.10.2”