Rails server couldn't start in linux [closed] - ruby-on-rails

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I installed ruby 2.1.0 and rails 4.0.4. I created an application. When I started 'rails server', I got following errors:
/home/chandra/.rvm/gems/ruby-2.1.0/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/chandra/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/uglifier-2.5.0/lib/uglifier.rb:3:in `<top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `each'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:72:in `block in require'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `each'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:61:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler.rb:132:in `require'
from /home/chandra/Desktop/webApplication/assignment1/blog/config/application.rb:7:in `<top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:74:in `require'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:74:in `block in <top (required)>'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap'
from /home/chandra/.rvm/gems/ruby-2.1.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Any suggestion? Thanks.

As the first line says: You need to install a JavaScript runtime library. And you will find further information at the given url: https://github.com/sstephenson/execjs

Install a javascript runtime like node js
if you are using ubuntu then follow the steps to get it install
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Have you tried to put gem 'therubyracer' in your gemfile?

Related

I can´t run server in Ubuntu 14.02 with ruby 2.2.2 and Rails 4

I´ve a problem when run Rails server. I just installed gem server, but still not working. I am new to the world of programming . I am grateful to anyone who can help me.
Copy an image of the error: http://i.stack.imgur.com/wS7oS.png.
/home/hugo/.rvm/gems/ruby-2.2.2/gems/activesupport-4.0.5/lib/active_support/values/time_zone.rb:283: warning: circular argument reference - now
/home/hugo/.rvm/gems/ruby-2.2.2/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/hugo/.rvm/gems/ruby-2.2.2/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler/runtime.rb:76:in `require'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler/runtime.rb:72:in `each'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler/runtime.rb:61:in `each'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler/runtime.rb:61:in `require'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.2/lib/bundler.rb:133:in `require'
from /home/hugo/pin_board/config/application.rb:7:in `<top (required)>'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/railties-4.0.5/lib/rails/commands.rb:74:in `require'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/railties-4.0.5/lib/rails/commands.rb:74:in `block in <top (required)>'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/railties-4.0.5/lib/rails/commands.rb:71:in `tap'
from /home/hugo/.rvm/gems/ruby-2.2.2/gems/railties-4.0.5/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
This seems like a similar question to ExecJS and could not find a JavaScript runtime. The resolution here was to ensure NodeJS was installed on the machine:
sudo apt-get install nodejs
uncomment
gem 'therubyracer', platforms: :ruby
in your Gemfile.
Please do
bundle install
after adding 'therubyracer' gem

undefined method eager_autoload when trying to start rails server [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
UPDATE: I fixed the error by installing rack-cache gem
I was trying to start a rails server on one of my project and got this error
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_controller/metal/strong_parameters.rb:105: warning: already initialized constant NEVER_UNPERMITTED_PARAMS
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_controller/metal/strong_parameters.rb:105: warning: already initialized constant NEVER_UNPERMITTED_PARAMS
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-action_caching-1.1.0/lib/action_controller/action_caching.rb:3:in `<module:Caching>': undefined method `eager_autoload' for ActionController::Caching:Module (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-action_caching-1.1.0/lib/action_controller/action_caching.rb:2:in `<module:ActionController>'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-action_caching-1.1.0/lib/action_controller/action_caching.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/actionpack-action_caching-1.1.0/lib/actionpack/action_caching.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in `rescue in block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /vagrant/captiv8/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/rvm/gems/ruby-1.9.3-p448/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 the actionpack gem but the problem still persist.
try command "bundle exec rails server"

ruby tutorial to launch my app

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
Just add a JavaScript runtime to your Gemfile (for example, execJS): gem 'execjs'
Then, just run bundle install and it should work.
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.

javascript runtime error with `rails s` command on remote server

I just set up a VPS to prepare for launching a Rails app and, on the actual remote server, I created a new rails project to test things out, only doing rails new blog -d postgresql. I then tried to start the server using the rails s command and got the error below.
.rvm/gems/ruby-1.9.3-p429#anwalt/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 /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/uglifier-2.1.1/lib/uglifier.rb:3:in `require'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/uglifier-2.1.1/lib/uglifier.rb:3:in `<top (required)>'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/michael/blogy/config/application.rb:7:in `<top (required)>'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `require'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `block in <top (required)>'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
from /home/michael/.rvm/gems/ruby-1.9.3-p429#anwalt/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I installed $ gem install execjs but still get the same error (I think I have to require it somewhere). Anyways, my question is, why wouldn't the rails s command work on a VPS out of the box the way that it works on a local machine, and, if not using rails s command how am I supposed to start the application once I do launch my real app (rather than this dummy app).
Try to install node.js via apt-get install nodejs or sudo apt-get install nodejs if you are using debian\ubuntu.

Does TinyTDS support Ruby 2.0.0?

I am having real trouble trying to get TinyTDS working with Ruby 2.0.0 on Windows 7.
When i run a rails c (or require tiny_tds from an irb), i get the following:
D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- tiny_tds/tiny_tds (LoadError)
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/tiny_tds-0.5.1-x86-mingw32/lib/tiny_tds.rb:16:in `rescue in <top (required)>'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/tiny_tds-0.5.1-x86-mingw32/lib/tiny_tds.rb:12:in `<top (required)>'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from S:/code/user/app/ruby2_test/config/application.rb:7:in `<top (required)>'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:39:in `require'
from D:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have tried installing the latest version of the gem:
gem install tiny_tds --pre
And looking inside:
D:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\tiny_tds-0.6.0.rc1-x86-mingw32\lib\tiny_tds
I can see there is no 2.0 directory, which leads me to believe version 2.0 isn't supported. However i can see no mention on the TinyTDS github or any other sites about this issue.
So, am i missing something or does TinyTDS currently just not work with Ruby 2.0?
Copying the answer from the comments in order to remove this question from the "Unanswered" filter:
I believe this is an issue with OS that you are using as another
individual had the same issue. As stated I believe this is a
dependency issue with Windows. Please see the comment from MetaSkills
- https://github.com/rails-sqlserver/tiny_tds/issues/110#issuecomment-15503928
~ answer per David

Resources