# Rails doesn't work



## hesam (Aug 12, 2012)

Hi,
  I try installing rails on freebsd 9 but it doesn't work I tried both gem and ports.
error message for 
	
	



```
rails server
```
 command is 

```
/usr/local/lib/ruby/gems/1.9/gems/execjs-1.4.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)
	from /usr/local/lib/ruby/gems/1.9/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
	from /usr/local/lib/ruby/gems/1.9/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
	from /usr/local/lib/ruby/gems/1.9/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
	from /usr/local/lib/ruby/gems/1.9/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
	from /usr/local/lib/ruby/gems/1.9/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `each'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `block in require'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
	from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
	from /usr/home/hesam/rails_projects/first_app/config/application.rb:7:in `<top (required)>'
	from /usr/local/lib/ruby/gems/1.9/gems/railties-3.2.7/lib/rails/commands.rb:53:in `require'
	from /usr/local/lib/ruby/gems/1.9/gems/railties-3.2.7/lib/rails/commands.rb:53:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/1.9/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
	from /usr/local/lib/ruby/gems/1.9/gems/railties-3.2.7/lib/rails/commands.rb:50:in `<top (required)>'
	from script/rails:6:in `require'
	from script/rails:6:in `<main>'
```
by the way I uninstalled ruby 1.8 and had installed ruby 1.9.


----------



## UNIXgod (Aug 13, 2012)

If you plan to work with multiple rubies look into rvm( if anything for the gemset feature) or jails in while attempting to work with a synced stack.


----------



## graudeejs (Aug 13, 2012)

> ```
> /usr/local/lib/ruby/gems/1.9/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': [red]Could not find a JavaScript runtime.[/red]
> ```



You need to install www/node


----------



## hesam (Aug 13, 2012)

*therubyracer*

Hi,
thanks, after installing node port it run but now therubyracer make this error:

```
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer-freebsd:
	ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby19 extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/bin/ruby19
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9/gems/therubyracer-freebsd-0.10.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9/gems/therubyracer-freebsd-0.10.1/ext/v8/gem_make.out
```


----------



## graudeejs (Aug 13, 2012)

Sorry, I can't help you with that.
I suggest you try using rvm.


----------



## zhoopin (Aug 14, 2012)

You should install devel/libexecinfo port.


----------



## mnaim (Dec 2, 2012)

This may be a bit late, but if you checkout ExecJS page on GitHub you will find out that ExecJS supports several runtimes.  In other words, you only need one runtime.  So, in your case, Node is all you need if that's what you downloaded.  No need for the rubyracer gem anymore.  Just comment "gem rubyracer" in your Gemfile, and you are good to go.  Here is a copy-paste from the docs:

ExecJS supports any of these runtimes:
therubyracer - Google V8 embedded within Ruby
therubyrhino - Mozilla Rhino embedded within JRuby
Node.js
Apple JavaScriptCore - Included with Mac OS X
Microsoft Windows Script Host (JScript)


----------

