Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

后端 未结 9 1405
甜味超标
甜味超标 2021-01-30 03:58

My website has been broken since Dreamhost upgraded their servers a couple of weeks ago. I have been tearing my hair out trying to get it fixed and made some progress but am stu

相关标签:
9条回答
  • 2021-01-30 04:23

    libv8 is an OS library; you'll need to install the correct Linux system library. If you're running Ubuntu, it's

    sudo apt-get install libv8-dev
    

    Alternatively, you can install node.js which is available as a Debian/Ubuntu package for various distros, e.g. http://ppa.launchpad.net/chris-lea/node.js/ubuntu

    You may save yourself a lot of trouble by deploying on Heroku instead where you don't have to manage the OS or components for gems.

    0 讨论(0)
  • 2021-01-30 04:23

    If you're on Ubuntu, install nodejs

    sudo apt-get install nodejs
    
    0 讨论(0)
  • 2021-01-30 04:24

    I just a saw a presentation on this.

    I've used rubytheracer up till now. Apparently it ain't so great. And it's huge.

    But you can use any javascript runtime.

    The other two recommended are execjs and node.js (which is very hot right now).

    Make sure to gem install the selected gem and then bundle install or bundle update for your app.

    One other note is that you should switch to 1.9.2 also.
    Install RVM (bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)) and you can have both 1.8.7 and 1.9.2 side-by-side.

    0 讨论(0)
  • 2021-01-30 04:24

    Add following gem in Gemfile and try with the bundle install

    gem "therubyracer", "~> 0.10.2"

    0 讨论(0)
  • 2021-01-30 04:28

    I would suggest installing Nodejs. It worked for me.

    Just go to your terminal and type in :

    sudo apt-get install node.js

    Enter your password...And press 'Y' whenever it asks for a confirmation. I hope this helps !!!

    0 讨论(0)
  • 2021-01-30 04:35

    I've just hit the very same problem on my Win7 dev machine. It looks like installing https://github.com/hiranpeiris/therubyracer_for_windows and adding gem 'therubyracer' to the Gemfile sorts things out.

    Before:

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

    This basically means that Rails needs rubyracer and libv8.

    After:

    $ 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]
    (...)
    
    0 讨论(0)
提交回复
热议问题