Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

runtimes.rb: autodetect Could not find a JavaScript runtime #154

Closed
mnsanghvi opened this issue Jul 10, 2014 · 13 comments
Closed

runtimes.rb: autodetect Could not find a JavaScript runtime #154

mnsanghvi opened this issue Jul 10, 2014 · 13 comments

Comments

@mnsanghvi
Copy link

execjs: 2.2.1
ruby: 2.1.0
OS: Debian/testing on PowerPC

I am trying to use Jekyll (http://www.jekylrb.com) and I get the following error when I do
anything with it:

% jekyll --version
/var/lib/gems/2.1.0/gems/execjs-2.2.1/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 /var/lib/gems/2.1.0/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:ExecJS>'
        from /var/lib/gems/2.1.0/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/jekyll-coffeescript-1.0.0/lib/jekyll-coffeescript.rb:2:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/jekyll-2.1.0/lib/jekyll.rb:75:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/jekyll-2.1.0/bin/jekyll:6:in `<top (required)>'
        from /usr/local/bin/jekyll:23:in `load'
        from /usr/local/bin/jekyll:23:in `<main>'

'''

I have Rhino and Spidermonkey installed.   I have also installed therubyrhino as per the documentation.

@naortega
Copy link

This seemed to work for me: what I did is that I saw that it was asking for some execjs stuff so I ran the command % dpkg -l | grep execjs. I got nothing, so a did an apt-cache search and found the ruby-execjs package. After I installed that it all worked fine.

execjs: 2.2.1
ruby: 2.1.0.3
OS: Debian Jessie/8

(I feel bad that it took this long for you to get an answer)

@mnsanghvi
Copy link
Author

Thanks for the tip, but this will not work on non-Intel platforms because
ruby-execjs depends on nodejs, which is Intel only.,
I am running on a PowerPC based G4 Mac.

On Sun, Aug 17, 2014 at 2:44 PM, Nicolás A. Ortega <notifications@github.com

wrote:

This seemed to work for me: what I did is that I saw that it was asking
for some execjs stuff so I ran the command % dpkg -l | grep execjs. I got
nothing, so a did an apt-cache search and found the ruby-execjs package.
After I installed that it all worked fine.

execjs: 2.2.1
ruby: 2.1.0.3
OS: Debian Jessie/8


Reply to this email directly or view it on GitHub
#154 (comment).

Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com

@Connorhd
Copy link

Install therubyracer? therubyrhino is for jruby.

@mnsanghvi
Copy link
Author

I did install therubyracer and still had no luck with it. At the moment I have stepped away from using
jekyll and am going with plain Emacs/org-mode based static publishing. This can be closed, unless folks want to keep it open.

@peterljung
Copy link

I have the same issue on OpenBSD 5.6.

I have tried different options. I tried to intall libv8 with

pkg_add libv8
gem install libv8 -- --with-system-v8

Then I tried to install therubyracer through package.

pkg_add ruby20-therubyracer

After I installed therubyracer the simple example works fine in irb

require "execjs"
ExecJS.eval "'red yellow blue'.split(' ')"
# => ["red", "yellow", "blue"]

But I still get this error when I try to start rails (3.2.21) server.

rails server
/usr/local/lib/ruby/gems/2.0/gems/gems/execjs-2.2.2/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 /usr/local/lib/ruby/gems/2.0/gems/gems/execjs-2.2.2/lib/execjs.rb:5:inmodule:ExecJS'
from /usr/local/lib/ruby/gems/2.0/gems/gems/execjs-2.2.2/lib/execjs.rb:4:in `<top (required)>'

I also tried to force runtime selection to ruby_racer and try to make sure that available? returns true.

export EXECJS_RUNTIME="RubyRacer"
irb
irb(main):001:0> require "v8"
=> true
rails server
/usr/local/lib/ruby/gems/2.0/gems/execjs-2.2.2/lib/execjs/runtimes.rb:65:in `from_environment': therubyracer (V8) runtime   is not available on this system (ExecJS::RuntimeUnavailable)
    from /usr/local/lib/ruby/gems/2.0/gems/execjs-2.2.2/lib/execjs/runtimes.rb:50:in `autodetect'
    from /usr/local/lib/ruby/gems/2.0/gems/execjs-2.2.2/lib/execjs.rb:5:in `<module:ExecJS>'

So it seems that something works but execjs still choke on start.

UPDATE:

This seems to work with Node runtime on OpenBSD.

pkg_add node

rails server
=> Booting WEBrick
=> Rails 3.2.21 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-12-15 22:01:16] INFO  WEBrick 1.3.1
[2014-12-15 22:01:16] INFO  ruby 2.0.0 (2014-05-08) [x86_64-openbsd]
[2014-12-15 22:01:16] INFO  WEBrick::HTTPServer#start: pid=7376 port=3000

So node runtime works. Still strange that I didn't get RubyRacer to work.

@voxik
Copy link

voxik commented Dec 22, 2014

The v8 is issue on non-Intel platforms. Hence Fedora's ARM guys suggest to use WebKit's JavaScriptCore on ARM, provided by webkitgtk4-devel package. Unfortunately, the path [1] is hardcoded and Mac specific. Is there some way around?

[1] https://github.com/sstephenson/execjs/blob/master/lib/execjs/runtimes.rb#L30

@wellington1993
Copy link

Add "gem 'therubyracer'" on Gemfile works for me...

@ComputerMachine
Copy link

@welligton1993 adding that to the gemfile then using bundle install worked.

@wellington1993
Copy link

@Red-Nova Exactly... Fist add "gem 'therubyracer' to Gemfile and after execute bundle install

@vicmunoz
Copy link

execjs: 2.2.1
ruby: 1.9.3-p551
OS: Ubuntu 14.04.01

Reproduced using this tutorial code https://github.com/gotealeaf/bootstrap-todo-app
Fixed adding 'therubyracer' to Gemfile as workaround worked for me

@josh
Copy link
Contributor

josh commented Mar 12, 2015

This repository has been deprecated and has moved to https://github.com/rails/execjs.

@josh josh closed this as completed Mar 12, 2015
@ganni
Copy link

ganni commented Jun 9, 2015

installing therubyracer gem worked for me

@ghost
Copy link

ghost commented Jan 20, 2016

nano Gemfile
add in the file : gem 'therubyracer'
bundle

Works great 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants