-1

i'm just starting with an Unix based OS i installed RVM to do the same basic tutorial like windows(dos), but i get an error, i tried to do the same work in root/user shell but is the same when i run rails server i get this message:

/usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.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 /usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:5:in `<module:ExecJS>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs.rb:4:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.2.1/lib/uglifier.rb:3:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/raul/blog/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

i reviwed the gem command and dome problems was founded too. Execjs is installed several times in my machine, root->user. This is what i get with gem check:

json-1.8.0.gem has 12 problems
  ext/json/ext/generator/.RUBYARCHDIR.time:
    Extra file
  ext/json/ext/generator/Makefile:
    Extra file
  ext/json/ext/generator/generator.o:
    Extra file
  ext/json/ext/generator/generator.so:
    Extra file
  ext/json/ext/generator/siteconf20130920-14093-1b8hzo9.rb:
    Extra file
  ext/json/ext/parser/.RUBYARCHDIR.time:
    Extra file
  ext/json/ext/parser/Makefile:
    Extra file
  ext/json/ext/parser/parser.o:
    Extra file
  ext/json/ext/parser/parser.so:
    Extra file
  ext/json/ext/parser/siteconf20130920-14093-zefm93.rb:
    Extra file
  lib/json/ext/generator.so:
    Extra file
  lib/json/ext/parser.so:
    Extra file
Hell0
  • 349
  • 1
  • 6
  • 19

2 Answers2

1

Install node

sudo apt-get install nodejs

followed by

gem install execjs

or just put gem 'execjs' in your gemfile.

EDIT: i'm editing my answer based on your edits and comments.

Nikola
  • 817
  • 13
  • 19
  • is installed, i read the git docs, i swear. `Unable to locate package nodejs` – Hell0 Sep 22 '13 at 07:51
  • `Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package nodejs` <--result – Hell0 Sep 22 '13 at 20:32
1

Just add a JavaScript runtime to your Gemfile (for example, execJS): gem 'execjs'

Then, just run bundle install and it should work.

Simon Ninon
  • 2,371
  • 26
  • 43
  • the machine says: `while executing gem ... (Gem::CommandLineError) Unknown command execjs` – Hell0 Sep 22 '13 at 20:08
  • i tried to set up the envoirement variable, writing something like a mini path. i runed this "mini" typing `source <>` then i can try to see the versions of gem rails, ruby, bundle, etc. But when i run `rails server` the whole lines above. – Hell0 Sep 22 '13 at 20:13
  • `require "execjs/module" require "execjs/disabled_runtime" require "execjs/external_runtime" require "execjs/johnson_runtime" require "execjs/mustang_runtime" require "execjs/ruby_racer_runtime" require "execjs/ruby_rhino_runtime" module ExecJS module Runtimes Disabled = DisabledRuntime.new ` <<----this line can be changed by `Enable` or is a bad idea? – Hell0 Sep 22 '13 at 20:28
  • No, you are wrong. You just wrote the command `gem 'execjs'` in your terminal instead of adding the line `gem 'execjs'` to your Gemfile. – Simon Ninon Sep 22 '13 at 21:57
  • where i must add this line? in : `/usr/local/rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.1/lib/execjs/runtimes.rb` – Hell0 Sep 23 '13 at 13:26
  • update your original question with the contents of your gemfile – Nikola Sep 23 '13 at 14:15
  • In /path/to/your/rails_app/Gemfile.rb . – Simon Ninon Sep 23 '13 at 14:45