decko-commons / decko

Start with a deck of wiki cards. Develop it into a rich web app.
https://www.decko.org
GNU General Public License v3.0
55 stars 15 forks source link

During `decko seed` getting ExecJS::RuntimeUnavailable message (with solution) #158

Open tukanos opened 6 years ago

tukanos commented 6 years ago

My configuration:

[smalltalk@localhost _info_]$ ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
[smalltalk@localhost _info_]$ uname -a
Linux localhost.localdomain 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[smalltalk@localhost _info_]$ hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: beb4030b979d4cdcbf51ec99034121fc
           Boot ID: ef48b881066040b098767226d0855d48
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.26.2.el7.x86_64
      Architecture: x86-64

This is for those who may encounter similar issues when installing Decko and for the developers so they can fix it.

I wanted to create a testing decko installation and I'm getting a ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. message.

I have installed the javascript google's V8 runtime using: gem install therubyracer.

When I test the testing code it in irb session I'm getting anwers:

[smalltalk@localhost _info_]$ irb
2.3.0 :001 > require 'execjs'
 => true 
2.3.0 :002 > ExecJS.eval "'red yellow blue'.split(' ')"
 => ["red", "yellow", "blue"] 

When running decko seed I'm getting this error:

...
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in `<top (required)>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/mod/machines/set/abstract/script.rb:3:in `<module:Script>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/mod/machines/set/abstract/script.rb:-4:in `<class:Abstract>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/mod/machines/set/abstract/script.rb:-4:in `<module:Set>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/mod/machines/set/abstract/script.rb:-4:in `<class:Card>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/mod/machines/set/abstract/script.rb:-4:in `<main>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/module_template.rb:18:in `eval'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/module_template.rb:18:in `build'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy/eval.rb:10:in `block in load_modules'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:52:in `block in each_file_in_dir'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:49:in `each'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:49:in `each_file_in_dir'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:39:in `block (2 levels) in each_file'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:38:in `each'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:38:in `block in each_file'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/dirs.rb:114:in `block in each'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/dirs.rb:111:in `each'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/dirs.rb:111:in `each'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy.rb:35:in `each_file'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/load_strategy/eval.rb:8:in `load_modules'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/loader.rb:35:in `load'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/loader/set_loader.rb:22:in `load'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod/loader.rb:45:in `load_mods'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card/mod.rb:55:in `load'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/cardio.rb:10:in `block in <top (required)>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/lib/card.rb:180:in `<top (required)>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `block in load_interlock'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:36:in `load_interlock'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:357:in `require_or_load'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:510:in `load_missing_constant'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:542:in `load_missing_constant'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:542:in `load_missing_constant'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:202:in `const_missing'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/decko-0.3.7/lib/decko/application.rb:24:in `block in <class:Application>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
/home/smalltalk/web/_info_/config/environment.rb:5:in `<top (required)>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/decko-0.3.7/lib/decko/tasks/alias.rb:7:in `block in alias_task'
/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/home/smalltalk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/home/smalltalk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => card:reset_cache => environment
(See full trace by running task with --trace)
...

I have tried to export the variable

EXECJS_RUNTIME=RubyRacer
export EXECJS_RUNTIME=RubyRacer

I got an error:

[smalltalk@localhost _info_]$ decko seed
bundle exec rake decko:seed
Database '_info__production' already exists
rake aborted!
ExecJS::RuntimeUnavailable: therubyracer (V8) runtime is not available on this system

The solution:

Edit Gemfile and add dependencies:

gem 'execjs'
gem 'therubyracer'

Now the bundle rake runs correctly:

decko seed
bundle exec rake decko:seed
Database '_info__production' already exists
not dropped
creating
loading schema
-- create_table("card_actions", {:id=>:integer, :force=>:cascade})
   -> 0.0143s
-- create_table("card_acts", {:id=>:integer, :force=>:cascade})
   -> 0.0064s
-- create_table("card_changes", {:id=>:integer, :force=>:cascade})
   -> 0.0115s
-- create_table("card_references", {:id=>:integer, :force=>:cascade})
   -> 0.0165s
-- create_table("card_revisions", {:id=>:integer, :force=>:cascade})
   -> 0.0076s
-- create_table("cards", {:id=>:integer, :force=>:cascade})
   -> 0.0154s
-- create_table("delayed_jobs", {:force=>:cascade})
   -> 0.0199s
-- create_table("schema_migrations_core_cards", {:id=>false, :force=>:cascade})
   -> 0.0045s
-- create_table("schema_migrations_deck_cards", {:id=>false, :force=>:cascade})
   -> 0.0050s
-- create_table("sessions", {:id=>:integer, :force=>:cascade})
   -> 0.0060s
-- create_table("users", {:id=>:integer, :force=>:cascade})
   -> 0.0062s
update card_migrations
-- assume_migrated_upto_version("20170830210517", ["/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.7/db/migrate_core_cards"])
   -> 0.0095s
loading bootstrap
set symlink for assets
reset cache
ethn commented 6 years ago

Thanks so much for leaving this.

For many, the simpler way to avoid this problem is to install Node.js, which includes a javascript runtime that is easily found on most systems and avoids the need for any special configuration in the Gemfile. This is why Node.js is listed among the System Requirements (https://github.com/decko-commons/decko/blob/master/decko/README.rdoc)

But that is kind of weak sauce, since the error message didn't help you much at all in solving this. I'll leave this issue open until we have better messaging and make various solutions, including yours, easier to find in cases where a deck is installed and run without a runtime on the ready.

tukanos commented 6 years ago

You are welcome. I'm happy I could help a little.

The logic I followed: 1) Got an error - followed the error link https://github.com/rails/execjs 2) Took the first suggested run time 3) Made it work

The table you have at the link https://github.com/decko-commons/decko/blob/master/decko/README.rdoc is somewhat confusing to me.

I would prefer a style where you would specify the most tested version as being preferred. The alternatives should work too but you would write that they where not that extensively tested or deployed. (I don't know with database if MySQL is tested more than PostgreSQL).

System requirements:

Preferred

Alternative

Ruby

version 2.3.0p0

> 2.3.0

Bundler

1.13.x

> 1.0

ImageMagick

6.7.8.9

> 6.7.8.0

A database engine

Either MySQL 5.7 OR PostgreSQL 9.4.x (equivalent)

or newer (for both engines)

Javascript engine

Node.js (8.9.4)

any other any another javascript engine

ethn commented 6 years ago

Cool, thanks for that. I'll update our README.

To answer your question, we do continuous integration testing on both MySQL and PostgreSQL, but the site driving development uses MySQL, so it's inevitably more thoroughly field tested.

ethn commented 6 years ago

I still haven't addressed the core remaining issue (error detection around missing JS runtimes), but I did add a Dependency versions card that gets to some of the issues we've been discussing. (linked to from the "get started") page.

It's not as pretty/handy as your table, but it's a lot easier to maintain, and given how small our team is and how far behind our docs are, that's probably a smarter way for us to go right now.

tukanos commented 6 years ago

Do whatever is easiest for you to! I know it can be difficult to handle everything in small teams.

I'm glad that I could help a little.