Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

yizeng opened this issue May 7, 2014 · 41 comments

Comments

@yizeng
Copy link
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
Copy link
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//issues/2327
.

@davidcelis
Copy link
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 added a commit to davidcelis/jekyll-coffeescript that referenced this issue May 7, 2014
`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!
@parkr
Copy link
Member

parkr commented May 7, 2014

Maybe we should make jekyll-coffeescript optional?

@davidcelis
Copy link
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
Copy link

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
Copy link
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//issues/2327#issuecomment-42611468
.

@benbalter
Copy link
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
Copy link
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
Copy link
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
Copy link
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//issues/2327#issuecomment-42672826
.

@parkr
Copy link
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
Copy link

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
Copy link

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).

@doktorbro
Copy link
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
Copy link
Member

parkr commented Jun 26, 2014

Did you install NodeJS or therubyracer?

@doktorbro
Copy link
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...

@doktorbro
Copy link
Member

@parkr Same error after installing therubyracer.

@sethlopezme
Copy link

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.

@doktorbro
Copy link
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
Copy link

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.

@doktorbro
Copy link
Member

@mchelen I removed Therubytracer after I installed Nodejs.

@Rugal
Copy link

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
Copy link
Member

parkr commented Jul 31, 2014

Documented.

@parkr parkr closed this as completed Jul 31, 2014
@etoews
Copy link

etoews commented Aug 1, 2014

@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.

@parkr
Copy link
Member

parkr commented Aug 1, 2014

@MiPnamic
Copy link

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
Copy link

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

@parkr
Copy link
Member

parkr commented Sep 7, 2014

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

@konklone
Copy link
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
Copy link
Contributor

mpalmer commented Sep 11, 2014

I agree, @konklone.

@parkr
Copy link
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
Copy link
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
Copy link

therubyracer worked for me.

@ffrank
Copy link

ffrank commented Sep 25, 2014

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

@wellington1993
Copy link

Add therubyracer to Gemfile works for me...

@akoimeexx
Copy link

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 added a commit to adoliver/mayday-2.0-frontend that referenced this issue Apr 22, 2015
jekyll core had CoffeeScript added as a requirement. See jekyll/jekyll#2327
cdown added a commit to cdown/chrisdown.name that referenced this issue Apr 23, 2015
@ayodejioju
Copy link

Lovely thread. Very helpful too.

@fernando-nog
Copy link

Install node.js work for me...

@BigOcto
Copy link

BigOcto commented Sep 5, 2015

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

@eddiejaoude
Copy link

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
Copy link
Contributor

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

@jekyll jekyll 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.
Projects
None yet
Development

No branches or pull requests