Why isn't the rails server working? [duplicate] - ruby-on-rails

This question already has answers here:
Rails - Could not find a JavaScript runtime?
(13 answers)
Closed 7 years ago.
The Following is the response that the terminal gives me once I run the rails server command. I am on Linux Ubuntu
/home/tor/.rvm/gems/ruby-2.0.0-p643/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/tor/.rvm/gems/ruby-2.0.0-p643/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler/runtime.rb:76:in `require'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler/runtime.rb:72:in `each'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler/runtime.rb:72:in `block in require'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler/runtime.rb:61:in `each'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler/runtime.rb:61:in `require'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.4/lib/bundler.rb:134:in `require'
from /home/tor/Desktop/hello/config/application.rb:7:in `<top (required)>'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `require'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from /home/tor/Desktop/hello/bin/rails:8:in `require'
from /home/tor/Desktop/hello/bin/rails:8:in `<top (required)>'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
from /home/tor/.rvm/gems/ruby-2.0.0-p643/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/tor/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/tor/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/tor/Desktop/hello/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
The answer is in your error message, you need to install a JS runtime from the page listed.

Uncomment therubyracer in your Gemfile
gem 'therubyracer'
then you will have to do
bundle install

Add these gems:
gem 'therubyracer'
gem 'execjs'
Then run bundle install.

Related

Creating new Rails project on Ubuntu returning error

I am currently new to the Linux OS (Ubuntu). I was once learning to develop Rails application on Windows but I found out that it is better to develop Rails applications on Linux since there are some limitations on Windows. I dual booted my computer so I can have Linux and Windows at the same time.
So I installed Ruby and Rails using the RVM (I followed this setup: https://www.youtube.com/watch?v=hiPQynmnsiI) and I created a test project named web and placed it on my desktop. There were no errors prior to the creation of the project but when I ran the command rails s it returned the following:
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler /runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/home/arjay/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/uglifier-3.0.3/lib/uglifier.rb:5:in `require'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/uglifier-3.0.3/lib/uglifier.rb:5:in `<top (required)>'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/home/arjay/Desktop/web/config/application.rb:7:in `<top (required)>'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:88:in `require'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:88:in `block in server'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
/home/arjay/Desktop/web/bin/rails:9:in `require'
/home/arjay/Desktop/web/bin/rails:9:in `<top (required)>'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `load'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `call'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client/command.rb:7:in `call'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client.rb:30:in `run'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/bin/spring:49:in `<top (required)>'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `load'
/home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `<top (required)>'
/home/arjay/Desktop/web/bin/spring:14:in `require'
/home/arjay/Desktop/web/bin/spring:14:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Bundler Error Backtrace:
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
from /home/arjay/Desktop/web/config/application.rb:7:in `<top (required)>'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:88:in `require'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /home/arjay/Desktop/web/bin/rails:9:in `require'
from /home/arjay/Desktop/web/bin/rails:9:in `<top (required)>'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `load'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `call'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client/command.rb:7:in `call'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/client.rb:30:in `run'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/bin/spring:49:in `<top (required)>'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `load'
from /home/arjay/.rvm/gems/ruby-2.3.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `<top (required)>'
from /home/arjay/Desktop/web/bin/spring:14:in `require'
from /home/arjay/Desktop/web/bin/spring:14:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Thank you for anyone who can help me out!
Could not find a JavaScript runtime.
You need javascript runtime.
Solution 1: Run the following command install nodejs
sudo apt-get install nodejs
Solution 2: Add therubyracer gem in your Gemfile
gem 'therubyracer'
This will solve the issue
You should run
sudo apt-get install nodejs
For Reference follow url
click here

Error when launching a new rails app in Ubuntu 14.04

I am trying to create a new rails app on Ubuntu 14.04. This is my first time using Rails in Ubuntu, (previously developed in Windows 10). I set up the development environment, my ruby version is ruby 2.3.0p0 and rails version is 5.0.0. Once my dev environment was set up, I started a new project by typing in a terminal:
rails new MyApp
Then, I typed:
cd MyApp
bundle install
And finally, I attempted to start my rails server by typing:
rails s
Instead of the rails server starting, I get this response in the terminal:
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/home/rusty/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
/home/rusty/Maple/config/application.rb:7:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
/home/rusty/Maple/bin/rails:9:in `require'
/home/rusty/Maple/bin/rails:9:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
/home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/home/rusty/Maple/bin/spring:13:in `require'
/home/rusty/Maple/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Bundler Error Backtrace:
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
from /home/rusty/Maple/config/application.rb:7:in `<top (required)>'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
from /home/rusty/Maple/bin/rails:9:in `require'
from /home/rusty/Maple/bin/rails:9:in `<top (required)>'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
from /home/rusty/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/rusty/Maple/bin/spring:13:in `require'
from /home/rusty/Maple/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
My app was created successfully. All the appropriate files are located in my app's folder. I just can't seem to get the rails server to start.
I found a solution. Open a terminal and change to your app's directory. Example, type cd MyApp.
Then install the Rubyracer gem by typing gem install therubyracer in your terminal, and then add gem 'therubyracer' to your gemfile.
My rails server starts now. Thank you uDaY for helping me.

rails 4.2.1 server error

Hi I am new to rails and every time I try to view the server i get this
testapp$ rails s
/home/sky/.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/sky/.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/sky/.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/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require'
from /home/sky/.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/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/runtime.rb:76:in `require'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/runtime.rb:72:in `each'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/runtime.rb:72:in `block in require'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/runtime.rb:61:in `each'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler/runtime.rb:61:in `require'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.9/lib/bundler.rb:134:in `require'
from /home/sky/testapp/config/application.rb:7:in `<top (required)>'
from /home/sky/.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/sky/.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/sky/.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/sky/.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/sky/.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/sky/.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/sky/testapp/bin/rails:8:in `require'
from /home/sky/testapp/bin/rails:8:in `<top (required)>'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/sky/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/sky/testapp/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
what do?
You should ensure that you have a JS runtime declared in your Gemfile.
Try adding:
gem 'therubyracer'
or
gem 'execjs'
to your Gemfile and run:
bundle install
As mentioned above you need a JavaScript runtime. If you are unsure of which to choose, I've always been told to use Node.js

Can you help me why this error is happening when i try to run rails server

/home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/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 /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/uglifier-2.4.0/lib/uglifier.rb:3:in `require'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/uglifier-2.4.0/lib/uglifier.rb:3:in `<top (required)>'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/salmanalam/MyProject/config/application.rb:7:in `<top (required)>'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/salmanalam/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
There is no gem present to compile js code. you can use gem rubyracer or node which will help in compiling.
I have also got this error But when I installed NPN or Node js I solved your error please try it. I hope it solves the error.

Failure start rails server Windows 7 x 64

I'm starting to do some trials on rails. Today I'm trying to start the rails server but my Cmd throws this exception:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/run
times.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://gi
thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn
available)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-2.0.2/l
ib/execjs.rb:5:in `<module:ExecJS>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-2.0.2/l
ib/execjs.rb:4:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/uglifier-2.2.1
/lib/uglifier.rb:3:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/uglifier-2.2.1
/lib/uglifier.rb:3:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:72:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:70:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:70:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:59:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler/runtime.rb:59:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/
lib/bundler.rb:132:in `require'
from D:/Datos/Dropbox/Desarrollo/AprendiendoRuby/Rails/MiPrimerRailsApp/
config/application.rb:7:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:76:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:76:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/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 tried to reinstall rails and run the bundle install too. I added a line in the GemFile, but I didn't get a solution. What am I doing wrong?
Install execjs and therubyracer gems
Add the following to Gemfile
gem 'execjs'
gem 'therubyracer'
And then run
bundle install
First, Could not find a JavaScript runtime. See https://gi thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn available)
Second, don't even try to use Windows for rails development, guard your health

Resources