Could not find a JavaScript runtime. (ExecJS::RuntimeUnavailable) #2327

Closed
yizeng opened this Issue May 7, 2014 · 41 comments

Projects

None yet
@yizeng
Contributor
yizeng commented May 7, 2014

After upgrading to Jekyll 2.0.2 from 1.5.1, I met this issue while building my repository using jekyll serve --trace.

Environment:

  • Linux Mint 16, Ruby 2.1.1p76, Jekyll gem 2.0.2

Stacktrace:

/home/yze14/.rvm/gems/ruby-2.1.1/gems/execjs-2.0.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 /home/yze14/.rvm/gems/ruby-2.1.1/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/yze14/.rvm/gems/ruby-2.1.1/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/gems/ruby-2.1.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/gems/ruby-2.1.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/gems/ruby-2.1.1/gems/jekyll-coffeescript-1.0.0/lib/jekyll-coffeescript.rb:2:in `<top (required)>'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/gems/ruby-2.1.1/gems/jekyll-2.0.2/lib/jekyll.rb:73:in `<top (required)>'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in `require'
    from /home/yze14/.rvm/gems/ruby-2.1.1/gems/jekyll-2.0.2/bin/jekyll:6:in `<top (required)>'
    from /home/yze14/.rvm/gems/ruby-2.1.1/bin/jekyll:23:in `load'
    from /home/yze14/.rvm/gems/ruby-2.1.1/bin/jekyll:23:in `<main>'
    from /home/yze14/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
    from /home/yze14/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'

A little bit Googling told me it had something to do with Node.js. sudo apt-get install nodejs fixes it. I'm wondering if this is something should be handled by Jekyll installation or not (at least we might want to document it somewhere maybe?)

@mscharley
Contributor

Installing system packages isn't something jekyll should be doing. I'm more
curious what part of jekyll actually uses node as this isn't something I've
heard of before.

On 7 May 2014 21:56, Yi Zeng notifications@github.com wrote:

After upgrading to Jekyll 2.0.2 from 1.5.1, I met this issue while
building my repository https://github.com/yizeng/yizeng.me using jekyll
serve --trace.

Environment:

  • Linux Mint 16, Ruby 2.1.1p76, Jekyll gem 2.0.2

Stacktrace:

/home/yze14/.rvm/gems/ruby-2.1.1/gems/execjs-2.0.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 /home/yze14/.rvm/gems/ruby-2.1.1/gems/execjs-2.0.2/lib/execjs.rb:5:inmodule:ExecJS'
from /home/yze14/.rvm/gems/ruby-2.1.1/gems/execjs-2.0.2/lib/execjs.rb:4:in <top (required)>' from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:inrequire'
from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in require' from /home/yze14/.rvm/gems/ruby-2.1.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in<top (required)>'
from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in require' from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:inrequire'
from /home/yze14/.rvm/gems/ruby-2.1.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in <top (required)>' from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:inrequire'
from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in require' from /home/yze14/.rvm/gems/ruby-2.1.1/gems/jekyll-coffeescript-1.0.0/lib/jekyll-coffeescript.rb:2:in<top (required)>'
from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in require' from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:inrequire'
from /home/yze14/.rvm/gems/ruby-2.1.1/gems/jekyll-2.0.2/lib/jekyll.rb:73:in <top (required)>' from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:inrequire'
from /home/yze14/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:73:in require' from /home/yze14/.rvm/gems/ruby-2.1.1/gems/jekyll-2.0.2/bin/jekyll:6:in<top (required)>'
from /home/yze14/.rvm/gems/ruby-2.1.1/bin/jekyll:23:in load' from /home/yze14/.rvm/gems/ruby-2.1.1/bin/jekyll:23:in

'
from /home/yze14/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in eval' from /home/yze14/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in'

A little bit Googling told me it has something to do with Node.js. sudo
apt-get install nodejs fixes it. I'm wondering if this is something
should be handled by jekyll installation or at least document it somewhere?


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/issues/2327
.

@davidcelis
Contributor

The CoffeeScript gem depends on execjs which itself requires a JavaScript runtime. Node.js does fulfill this requirement, but you also could have bundled a gem called therubyracer. This probably should be documented in jekyll/jekyll-coffeescript

@davidcelis davidcelis added a commit to davidcelis/jekyll-coffeescript that referenced this issue May 7, 2014
@davidcelis davidcelis Note requirement of JavaScript runtime
`jekyll-coffeescript` requires a valid JavaScript runtime due to its dependency on ExecJS, but this is undocumented. jekyll/jekyll#2327 makes me think that it probably should be!
670f3ae
@davidcelis davidcelis referenced this issue in jekyll/jekyll-coffeescript May 7, 2014
Merged

Note requirement of JavaScript runtime #4

@parkr
Member
parkr commented May 7, 2014

Maybe we should make jekyll-coffeescript optional?

@davidcelis
Contributor

Maybe? I personally don't care about using CoffeeScript, but I guess I also don't care too much about the added dependency. I'm indifferent, though others in my shoes may prefer it to be an optional plugin. Although, that big 2.0.0 blog post did have a pretty big "Native Sass & CoffeeScript support" bullet point... 😉

@prayerslayer

I'm not using CoffeeScript either, but I host a Jekyll-generated blog on my VPS. I want to keep the machine as clean as possible and refuse therefore to install Node globally as long as I don't need it. A Ruby-based blogging engine happening to have a transitive dependency on a JS runtime does not count as "needing" for me :)

I would propose to either remove dependencies on non-Ruby things altogether or to include workarounds (such as therubyracer) by default. Maybe I'm in a minority there, but expect software written in Ruby to work in a Ruby-only environment.

Thank you very much for your effort by the way <3

@mscharley
Contributor

Agreed, and there's been conversation elsewhere in the issue queue about
this if you want to look for it.. I believe the consensus at the moment is
that the coffeescript plugin won't be a prerequisite of jekyll core going
forward.

On 9 May 2014 07:57, Nikolaus Piccolotto notifications@github.com wrote:

I'm not using CoffeeScript either, but I host a Jekyll-generated blog on
my VPS. I want to keep the machine as clean as possible and refuse
therefore to install Node globally as long as I don't need it. A Ruby-based
blogging engine happening to have a transitive dependency on a JS runtime
does not count as "needing" for me :)

I would propose to either remove dependencies on non-Ruby things
altogether or to include workarounds (such as therubyracer) by default.
Maybe I'm in a minority there, but expect things written in Ruby to work in
a Ruby-only environment.

Thank you very much for your effort by the way <3


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/issues/2327#issuecomment-42611468
.

@benbalter
Contributor

I'd really hate to add yet-another-config-option, especially when intent can be discerned very easily from filenames. Perhaps we could lazy-load coffeescript and sass if the generator discovers a .coffee or .sass file with YAML frontmatter?

@parkr
Member
parkr commented May 9, 2014

I'd really hate to add yet-another-config-option

What config option would we have to add? The proposed solution (#2362) simply loads the gems if they're there, and ignores them if not.

@benbalter
Contributor

You'd have to add it to the Gemfile though, right? The above error looks like it occurs when required, not when bundled, right?

@mscharley
Contributor

It's an error on require, yes.

On 10 May 2014 00:36, Ben Balter notifications@github.com wrote:

You'd have to add it to the Gemfile though, right? The above error looks
like it occurs when required, not when bundled, right?


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/issues/2327#issuecomment-42672826
.

@parkr
Member
parkr commented May 9, 2014

It's an error on require, yes.

It's required all the time. 😦 My solution illustrates this in the red. :)

@mchelen
mchelen commented May 21, 2014

Confirming bug after a fresh install of Jekyll 2.0.3 on a clean Ubuntu 14.04 system with Ruby 1.9.3.4.
After installation, trying to run Jekyll on an existing website repository showed the above ExecJS error. Installing either nodejs or therubyracer fixed the problem.

@borntyping

Shouldn't this - even if not permanent - be mentioned in the installation docs? Currently the requirements list is incomplete, since an external package is required for either nodejs or therubyracer (the latter requires a compiler, and the others are environment specific).

@everett-toews everett-toews referenced this issue in jclouds/jclouds-site May 28, 2014
Closed

Core concepts #101

@penibelst
Member

Same issue here in the same environment as @mchelen.

bundle exec rake test
/usr/bin/ruby2.0 -I"lib:lib:test" -I"/var/lib/gems/2.0.0/gems/rake-10.3.2/lib" "/var/lib/gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb" 
…
/var/lib/gems/2.0.0/gems/execjs-2.2.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)
@parkr
Member
parkr commented Jun 26, 2014

Did you install NodeJS or therubyracer?

@penibelst
Member

@parkr I am installing therubyracer just now:

sudo gem install therubyracer
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions.  This could take a while...
@penibelst
Member

@parkr Same error after installing therubyracer.

@sethlopezme

I had the same issue as above. Installing therubyracer didn't fix the issue. I had to install nodejs in order to get it working.

@penibelst
Member

I had the same issue as above. Installing therubyracer didn't fix the issue. I had to install NodeJS in order to get it working.

I confirm.

@mchelen
mchelen commented Jun 26, 2014

Weird, I assume therubyracer installed ok? That fixed the problem for me. Either way, the extra installation step should be documented.

@penibelst
Member

@mchelen I removed Therubytracer after I installed Nodejs.

@Rugal
Rugal commented Jul 15, 2014

I solve this problem by apt-get install nodejs too, got no idea why Javascript related to local machine nodejs. for more detail

@parkr
Member
parkr commented Jul 31, 2014

Documented.

@parkr parkr closed this Jul 31, 2014
@everett-toews

@parkr Can you please link to where this was documented?

It would be helpful to those Googling this problem in the future and stumble across this issue.

@MiPnamic

Same problem on a debian, trying a "jekyll new"... NodeJS was just installed times ago, I had to install therubyracer for get it work.

@carstenhag

After installing execjs and therubyracer it still showed this error. After installing nodejs it worked.

@parkr
Member
parkr commented Sep 7, 2014

We've specified NodeJS on our "Installation" doc page: http://jekyllrb.com/docs/installation/

@konklone
Contributor

NodeJS is a heavy and unexpected dependency for Jekyll, I think. I just ran into this and was pretty surprised. We're not using CoffeeScript, and I'm sure many, many users of Jekyll are not.

@mpalmer
Contributor
mpalmer commented Sep 11, 2014

I agree, @konklone.

@parkr
Member
parkr commented Sep 11, 2014

@konklone @mpalmer Yeah, we've discussed this after the 2.0 release: #2335. We'll remove bundled CoffeeScript support in Jekyll 3.

@konklone
Contributor

Gotcha - it's a shame #2335 started out so hotheadedly, but I'm glad it got to a good end result. If there's a good stable commit or tag to tie my Jekyll version to in the meantime, while the final 3.0 release gets worked out (which I'm sure will be some time), I'd use it.

@wizonesolutions

therubyracer worked for me.

@ffrank
ffrank commented Sep 25, 2014

therubyracer fixed me up to. Make sure to add it to your bundle.

@wellington1993

Add therubyracer to Gemfile works for me...

@akoimeexx

Incredibly irritating dependency. Building therubyracer and libv8 takes forever, but better than swamping my cell phone 'net access with node.js downloading at the moment. I don't even use sass or scss.

Looking forward to 3. =p

@adoliver adoliver added a commit to adoliver/mayday-2.0-frontend that referenced this issue Apr 22, 2015
@adoliver adoliver Update README.md
jekyll core had CoffeeScript added as a requirement. See jekyll/jekyll#2327
8c3aee7
@adoliver adoliver referenced this issue in MayOneUS/mayday-2.0-frontend Apr 22, 2015
Merged

Update README.md #128

@cdown cdown added a commit to cdown/chrisdown.name that referenced this issue Apr 23, 2015
@cdown cdown Install therubyracer to fix jekyll/jekyll#2327 f4986bb
@stugerdt

Lovely thread. Very helpful too.

@fernandoGN

Install node.js work for me...

@BigOcto
BigOcto commented Sep 5, 2015

sudo apt-get install nodejs. This is useful for me

@eddiejaoude

Installed nodejs which let me move on to the next error, now get this error...

`block in materialize': Could not find timers-4.0.1 in any of the sources`
@envygeeks
Member

Please ask your questions about non-direct problems on https://talk.jekyllrb.com, thanks!

@envygeeks envygeeks locked and limited conversation to collaborators Sep 10, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.