Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Owen Tran
Owen Tran
6,822 Points

"bin/rails server" command failing on fedora, please help

rails new testapp
cd testapp
bin/rails server
Application Address:
http://localhost:3000/

i am following the steps listed but when I get to bin/rails server this comes up:

/home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
    from /home/owen/testapp/config/application.rb:7:in `<top (required)>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/owen/testapp/bin/rails:8:in `require'
    from /home/owen/testapp/bin/rails:8:in `<top (required)>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client/rails.rb:28:in `load'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client/rails.rb:28:in `call'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client/command.rb:7:in `call'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/client.rb:26:in `run'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/bin/spring:48:in `<top (required)>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/binstub.rb:11:in `load'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.4/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/owen/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/owen/testapp/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

i went to the website it suggested and installed "gem install execjs" but no change.

I edited your post to format your commands and stack trace. :)

4 Answers

Nathan Williams offered an answer that will definitely work. I was going to suggest that you open your Gemfile, uncomment this line...

# gem "therubyracer"

...and run bundle install. Either way should work.

Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

woohoo! another Fedora user! greetings!

i usually just install node for the js executable; try sudo yum -y install node and give it another go.

HTH,

Nathan

Owen Tran
Owen Tran
6,822 Points

[owen@localhost testapp]$ sudo yum -y install node [sudo] password for owen: Loaded plugins: langpacks Package node-0.3.2-16.fc21.x86_64 already installed and latest version Nothing to do

[owen@localhost testapp]$ # gem therubyracer [owen@localhost testapp]$ bundle install Using rake 10.4.2 Using i18n 0.7.0 Using json 1.8.2 Using minitest 5.6.0 Using thread_safe 0.3.5 Using tzinfo 1.2.2 Using activesupport 4.2.1 Using builder 3.2.2 Using erubis 2.7.0 Using mini_portile 0.6.2 Using nokogiri 1.6.6.2 Using rails-deprecated_sanitizer 1.0.3 Using rails-dom-testing 1.0.6 Using loofah 2.0.1 Using rails-html-sanitizer 1.0.2 Using actionview 4.2.1 Using rack 1.6.0 Using rack-test 0.6.3 Using actionpack 4.2.1 Using globalid 0.3.5 Using activejob 4.2.1 Using mime-types 2.5 Using mail 2.6.3 Using actionmailer 4.2.1 Using activemodel 4.2.1 Using arel 6.0.0 Using activerecord 4.2.1 Using debug_inspector 0.0.2 Using binding_of_caller 0.7.2 Using columnize 0.9.0 Using byebug 4.0.5 Using coffee-script-source 1.9.1.1 Using execjs 2.5.2 Using coffee-script 2.4.1 Using thor 0.19.1 Using railties 4.2.1 Using coffee-rails 4.1.0 Using multi_json 1.11.0 Using jbuilder 2.2.13 Using jquery-rails 4.0.3 Using bundler 1.9.4 Using sprockets 3.0.2 Using sprockets-rails 2.2.4 Using rails 4.2.1 Using rdoc 4.2.0 Using sass 3.4.13 Using tilt 1.4.1 Using sass-rails 5.0.3 Using sdoc 0.4.1 Using spring 1.3.4 Using sqlite3 1.3.10 Using turbolinks 2.5.3 Using uglifier 2.7.1 Using web-console 2.1.2 Bundle complete! 12 Gemfile dependencies, 54 gems now installed. Use bundle show [gemname] to see where a bundled gem is installed.

I did both, it's still not working :( anymore suggestions?? bin/rails server gives me the identical message in the original post.

Owen Tran
Owen Tran
6,822 Points

ok guys i tried : sudo yum -y install nodejs

got it working now, Thanks. Started fedora a week ago, slowly getting there :)