首页 文章

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

提问于
浏览
53

自Dreamhost几周前升级服务器以来,我的网站已被破坏 . 我一直在撕扯我的头发试图修复它并取得了一些进展,但我坚持希望最后的问题 .

我'm using Rails 3.1.1 on Ruby 1.8.7 and get presented with a '无法启动Ruby(Rack)应用程序错误' from PhusionPassenger. It states that it '无法找到JavaScript运行时 . 有关可用运行时的列表,请参见https://github.com/sstephenson/execjs . (ExecJS :: RuntimeUnavailable)'. Searching for this on Dreamhost' s 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时,我看到一个错误 .

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

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

终端的完整错误反馈:

执行“cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703&& bundle install --gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile --path /home/futureproof/.gems / bundle --demployment --quiet - withoutout development test“servers:[”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':错误:无法构建gem原生扩展 . (Gem :: Installer :: ExtensionBuildError)** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] /usr/bin/ruby1.8 extconf.rb ** [out :: abunchofletters.co.uk] *** extconf.rb失败*** ** [out :: abunchofletters.co.uk]由于某些原因无法创建Makefile,可能缺少** [out :: abunchofletters.co . 英国]必要的库和/或 Headers . 检查mkmf.log文件以获取更多** [out :: abunchofletters.co.uk]详细信息 . 您可能需要配置选项 . ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk]提供配置选项:** [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 = $ / include ** [out :: abunchofletters.co.uk] --with-opt-lib ** [out :: abunchofletters.co.uk] --without-opt- lib = $ / 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:未初始化的常量Gem(NameError)** [out :: abunchofletters.co.uk]检查Python ... ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters .co.uk] Gem文件将保留在/home/futureproof/.gems/bundle/ruby/1.8/gems/libv8-3.3.10.4中进行检查 . ** [out :: abunchofletters.co.uk]结果登录到/home/futureproof/.gems/bundle/ruby/1.8/gems/libv8-3.3.10.4/ext/libv8/gem_make.out ** [out :: abunchofletters.co.uk]来自/usr/lib/ruby/1.8/rubygems/installer.rb:446:ineach'** [out :: abunchofletters.co.uk]来自/usr/lib/ruby/1.8/rubygems/ installer.rb:446:在build_extensions'** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:198:ininstall'** [out :: abunchofletters.co .h从/home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/source.rb:90:in从/ home / futureproof安装'** [out :: abunchofletters.co.uk] /.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:从/home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/安装'** [out :: abunchofletters.co.uk] installer.rb:73:来自/ home / futureproof /的install_gem_from_spec'** [out :: abunchofletters.co.uk] . 宝石/宝石/捆绑-1.1.rc / LIB /捆绑/ rubygems_integration.rb:93:在with_build_args'** [out :: abunchofletters.co.uk]来自/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运行'** [out :: abunchofletters.co.uk]来自/ home / futureproof / .gems / gems / bundler-1.1.rc / lib / bundler / installer.rb:55:从/home/futureproof/.gems/gems运行'** [out :: abunchofletters.co.uk] /bundler-1.1.rc/lib/bundler/installer.rb:12:in从/home/futureproof/.gems/gems/bundler-1.1.rc/lib安装'** [out :: abunchofletters.co.uk] /bundler/cli.rb:219:in从/home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task安装'** [out :: abunchofletters.co.uk] .rb:22:从/home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22发送'** [out :: abunchofletters.co.uk] :从/home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocat运行'** [out :: abunchofletters.co.uk] ion.rb:118:来自/home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263的invoke_task'** [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] * [out :: abunchofletters.co.uk]来自/home/futureproof/.gems/gems/bundler-1.1.rc/bin/bundle:13 ** [out :: abunchofletters.co.uk]来自/ home / futureproof /.gems/bin/bundle:19:in加载'** [out :: abunchofletters.co.uk]来自/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&&捆绑在abunchofletters.co上安装--gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile --path /home/futureproof/.gems/bundle --demployment --quiet --without development test'“ . 联合王国

8 回答

  • 1

    我建议安装 Nodejs . 它对我有用 .

    只需前往您的终端并输入:

    sudo apt-get install node.js

    输入您的密码...并在要求确认时按'Y' . 我希望这有帮助 !!!

  • 124

    在Gemfile中添加以下gem并尝试使用bundle install

    宝石“therubyracer”,“〜> 0.10.2”

  • 10

    libv8 是一个OS库;你'll need to install the correct Linux system library. If you'重新运行Ubuntu,它是

    sudo apt-get install libv8-dev
    

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

    通过在Heroku上部署而不必管理操作系统或宝石组件,您可以省去很多麻烦 .

  • 0

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

    sudo apt-get install nodejs
    
  • 0

    我在Dreamhost上使用这个宝石,使用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托管的2个Rails 3.1应用程序 .

  • 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将其路径添加到deploy.rb,添加以下行(在这种情况下添加了一些路径):

    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"
    

    你完成了

  • 33

    我只是看到了这方面的演示 .

    到目前为止我一直使用rubytheracer . 显然它不是那么好 . 这是巨大的 .

    但是你可以使用任何javascript运行时 .

    另外两个推荐是execjsnode.js(现在非常热) .

    确保 gem install 选定的宝石,然后 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 .

  • 5

    我刚刚在Win7开发机上遇到了同样的问题 . 它看起来像安装https://github.com/hiranpeiris/therubyracer_for_windows并将 gem 'therubyracer' 添加到 Gemfile 排序 .

    之前:

    $ 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]
    (...)
    

相关问题