Topic: Server Fail

I'm newb to both Linux and Ruby on Rails, and to the workings behind the user-friendly surface generally.

I've gotten the most recent Ruby, Ruby Gems and Rails, as well as attempting to get Mongrel (and finding in one place by Ruby admin or contributor that the distribution of Mongrel wasn't up to date with with Rails), but haven't been able to get the server going to get started in tutorial.

Trying to get the server going:

john@ubuntu:~/rails_space$ rails s
/usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect': Could not
find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available r
untimes. (ExecJS::RuntimeUnavailable)
        from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:5:in `<module:ExecJS>'
        from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:4:in `<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `requi
re'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top
(required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `requi
re'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top
(required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.1/lib/coffee-rails.rb:1:in `require
'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.1/lib/coffee-rails.rb:1:in `<top (r
equired)>'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require
'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (
2 levels) in require'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block i
n require'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require
'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
        from /home/john/rails_space/config/application.rb:7:in `<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:53:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:53:in `block in
<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:50:in `tap'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:50:in `<top (re
quired)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'



I then ended up further into one of these branches, getting:

john@ubuntu:/usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs$ ls
disabled_runtime.rb  johnson_runtime.rb  mustang_runtime.rb     ruby_rhino_runtime.rb  support
external_runtime.rb  module.rb           ruby_racer_runtime.rb  runtimes.rb            version.rb
john@ubuntu:/usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs$ rails s
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                                 # Default: /usr/bin/ruby1.9.1
  -b, [--builder=BUILDER]        # Path to a application builder (can be a filesystem path or URL)
  -m, [--template=TEMPLATE]      # Path to an application template (can be a filesystem path or URL)
      [--skip-gemfile]           # Don't create a Gemfile
      [--skip-bundle]            # Don't run bundle install
  -G, [--skip-git]               # Skip Git ignores and keeps
  -O, [--skip-active-record]     # Skip Active Record files
  -S, [--skip-sprockets]         # Skip Sprockets files
  -d, [--database=DATABASE]      # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/fro
ntbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
                                 # Default: sqlite3
  -j, [--javascript=JAVASCRIPT]  # Preconfigure for selected JavaScript library
                                 # Default: jquery
  -J, [--skip-javascript]        # Skip JavaScript files
      [--dev]                    # Setup the application with Gemfile pointing to your Rails checkout
      [--edge]                   # Setup the application with Gemfile pointing to Rails repository
  -T, [--skip-test-unit]         # Skip Test::Unit files
      [--old-style-hash]         # Force using old style hash (:foo => 'bar') on Ruby >= 1.9

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist

Rails options:
  -h, [--help]     # Show this help message and quit
  -v, [--version]  # Show Rails version number and quit

Description:
    The 'rails new' command creates a new Rails application with a default
    directory structure and configuration at the path you specify.

    You can specify extra command-line arguments to be used every time
    'rails new' runs in the .railsrc configuration file in your home directory.

    Note that the arguments specified in the .railsrc file don't affect the
    defaults values shown above in this help message.

Example:
    rails new ~/Code/Ruby/weblog

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
    See the README in the newly created application to get going.


Any help translating would be much appreciated.

Re: Server Fail

any help on this please?

Re: Server Fail

Double Alius wrote:

...
Trying to get the server going:

john@ubuntu:~/rails_space$ rails s
/usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect': Could not
find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available r
untimes. (ExecJS::RuntimeUnavailable)
....

Follow the instructions and get a javascript runtime.  Take a look around/google for postings etc. on therubyracer which is a commonly used runtime.  I assume you have created an app using 'rails new' and 'rails generate something' etc.

Re: Server Fail

Thanks for the help. I tried to install therubyracer, but after putting in the command gem install therubyracer I got this error:

Fetching: libv8-3.3.10.4-x86-linux.gem (100%)
Fetching: therubyracer-0.9.9.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
creating Makefile

make
g++ -I. -I/usr/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4-x86-linux/lib/libv8/v8/include -I/usr/inclu
de/ruby-1.9.1/i686-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_
FILE_OFFSET_BITS=64  -Wall -g -rdynamic -fPIC -fno-strict-aliasing -g -g -O2 -fPIC  -fno-strict-al
iasing -g -o v8_callbacks.o -c v8_callbacks.cpp
make: g++: Command not found
make: *** [v8_callbacks.o] Error 127


Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9 for inspection
.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/therubyracer-0.9.9/ext/v8/gem_make.out

I'd appreciate any help on this. I am trying to pick up fundamentals as I am going, so if it seems that I am missing blatantly obvious skills, I am, and could use directions for where to go to get them. Thanks.

Re: Server Fail

You probably need to install the build_essential package (sudo apt-get install build_essential).  It includes the g++ compiler and other things you need to build native extensions.

Re: Server Fail

thanks...i'll give this a shot.

Re: Server Fail

ok...so I've installed a few things:

1. the build-essential
2. therubyracer
3. execjs

and i've updated with 'gem update rails'

however, when i try to activate the server with 'rails s' or 'rails server' , I still get: /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs/runtimes.rb:50:in `autodetect': Could not fi
nd a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtime
s. (ExecJS::RuntimeUnavailable)
        from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:5:in `<module:ExecJS>'
        from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.3.0/lib/execjs.rb:4:in `<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (re
quired)>'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (re
quired)>'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.1/lib/coffee-rails.rb:1:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.1/lib/coffee-rails.rb:1:in `<top (requ
ired)>'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 l
evels) in require'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in r
equire'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
        from /home/john/rails_space/config/application.rb:7:in `<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:53:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:53:in `block in <t
op (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:50:in `tap'
        from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.0/lib/rails/commands.rb:50:in `<top (requi
red)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

help please

Re: Server Fail

gem 'execjs'
gem 'therubyracer'

bundle install

I have all worked