Rails console - process finished with exit code 0 - ruby-on-rails

Can't start rails console. When I'm trying to start it I 've got this message:
Loading development environment (Rails 3.2.12)
Process finished with exit code 0
It exits without any errors. But rails server starts without problems:
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-26 02:23:44] INFO WEBrick 1.3.1
[2013-04-26 02:23:44] INFO ruby 1.9.3 (2013-02-22) [x86_64-darwin12.2.0]
[2013-04-26 02:23:44] INFO WEBrick::HTTPServer#start: pid=2393 port=3000
I'm running Mac OS X with rvm.
Why rails console may not be working?

Did you try with bundle exec?
bundle exec rails c

If you're using RVM, try doing rvm implode and reinstall Ruby and Rails.

Related

Terminal does not work after running rails server

after running "rails server" on my mac to start my application, my terminal does not allow me to write commands in the terminal. All I get is the following, with the problem that I can not write any commands.
Last login: Mon Jan 2 13:19:07 on ttys001
Nicholass-MacBook-Pro:~ nicholaswenzel$ cd last_test
Nicholass-MacBook-Pro:last_test nicholaswenzel$ cd nofuckingidea
Nicholass-MacBook-Pro:nofuckingidea nicholaswenzel$ rails s
=> Booting WEBrick
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2017-01-02 13:23:18] INFO WEBrick 1.3.1
[2017-01-02 13:23:18] INFO ruby 2.2.3 (2015-08-18) [x86_64-darwin15]
[2017-01-02 13:23:18] INFO WEBrick::HTTPServer#start: pid=8743 port=3000
Can anyone help?
You can start your server in a background:
rails server &
But, usually, this problem can be resolving by starting an additional terminal process (open new terminal window or tab). In this case, you'll be able to see server logs in runtime.

Running Rails S with a fresh new app returns ERR_EMPTY_RESPONSE

I am using Vagrant to start a Rails app, everything seems right but then, when I create a test app, run rails s and go to localhost:3000 I get a ERR_EMPTY_RESPONSE and nothing is loaded. I get the following output when running rails s:
vagrant#rails-dev-box:~/projects/NewAppName$ rails s
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-08-20 11:45:45] INFO WEBrick 1.3.1
[2015-08-20 11:45:45] INFO ruby 2.2.1 (2015-02-26) [i686-linux]
[2015-08-20 11:45:45] INFO WEBrick::HTTPServer#start: pid=12075 port=3000
I already ran rake db:create && rake db:migrate, and created a controller for the root. Anyone has an idea of what can be happening? Thank you.
It's in localhost on vagrant, so you can't connect it.
Try rails s -b 0.0.0.0 and then connect to vagrant IP(192.168.50.4:3000, for example).

Can't Start Rails Server in Windows

I am newbie in ruby on rails. I'm currently installing Ruby on Rails.
I've done all the steps until : bundle install.
Then i type rails server to start the rails server. From what I read in http://guides.rubyonrails.org/command_line.html, after i type rails server, it's supposed to show:
$ cd commandsapp
$ bin/rails server
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-08-07 02:00:01] INFO WEBrick 1.3.1
[2013-08-07 02:00:01] INFO ruby 2.0.0 (2013-06-27) [x86_64-darwin11.2.0]
[2013-08-07 02:00:01] INFO WEBrick::HTTPServer#start: pid=69680 port=3000
but in my Command Line it show this, instead:
So the rails server is not running and when i type localhost:3000 or localhost:8000 in the browser, it says unable to connect(probably because the server isn't running).
Sorry my bad language.
You need to create a rails app and change into that directory before you can run the server. Try this:
rails new commandsapp # the name can be anything you want
cd commandsapp
rails server
"rails new " creates a new folder with the default rails layout (app, db, log etc).
The Error: 'require' : cannot load such file -- sqlite3/sqlite3_native (LoadError)
==> You must insert gem sqlite3/sqlite3_native into gemfile, then bundle install again. Try with rails server.

rails commands and rake are dumping unwanted list of all gems

It is very strange. I even tried a brand new project:
rails new abc
cd abc
rails s
The output is:
=> Booting WEBrick
=> Rails 4.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
active_support/descendants_tracker
active_support/core_ext/module/delegation
active_support/core_ext/object/to_param
active_support/core_ext/regexp
... lots more here
active_support/core_ext/array/extract_options
rack/utils
action_controller/metal/exceptions
[2015-04-23 19:35:42] INFO WEBrick 1.3.1
[2015-04-23 19:35:42] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
[2015-04-23 19:35:42] INFO WEBrick::HTTPServer#start: pid=12738 port=3000
It doesn't break anything, but it makes reading output to debug very difficult.
It happens for all usage of rails and rake, in or out of bundle exec, but not bundle commands like bundle list or bundle install
Strangest thing... but it went away when I updated from rails 4.1.1 to rails 4.2.1

Terminal command "rails server"

My terminal does not return to the usual command line prompt $ after I run rails server. If I open another Bash window everything works fine.
Should I just exit the first window, or will I interrupt some process?
Thanks for the advice!
If you run rails server or rails s, you wouldn't get that prompt. You need to press Ctrl-C to shutdown the server. That instruction is present is command shell itself (=> Ctrl-C to shutdown server).
(arup~>sample_app)$ rails s
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-01-27 02:22:02] INFO WEBrick 1.3.1
[2014-01-27 02:22:02] INFO ruby 2.0.0 (2013-02-24) [i686-linux]
[2014-01-27 02:22:02] INFO WEBrick::HTTPServer#start: pid=11223
Now see below, what happened when I did press Ctrl-C :
(arup~>sample_app)$ rails s
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-01-27 02:22:02] INFO WEBrick 1.3.1
[2014-01-27 02:22:02] INFO ruby 2.0.0 (2013-02-24) [i686-linux]
[2014-01-27 02:22:02] INFO WEBrick::HTTPServer#start: pid=11223 port=3000
^C[2014-01-27 02:24:59] INFO going to shutdown ...
[2014-01-27 02:24:59] INFO WEBrick::HTTPServer#start done.
Exiting
(arup~>sample_app)$
Yes when you use rails server or rails s the WEBrick server starts and keeps running it in the terminal tab you ran it on(till you interrupt it).
In Terminal Ctrl + C is used to kill/break/interrupt any process only
$ not showing means there is a process already running in that terminal and therefore you have to open a new terminal tab(Ctrl + Shift + T) and work there or break the existing ongoing process to get the $ and work in the present tab.
This also might help you out
http://help.codeschool.com/discussions/rails-for-zombies-2/225-after-i-enter-rails-server-on-the-command-line-the-command-line-doesnt-reappear
In other words you ideally can't or actually shouldn't use the terminal in which the server is running on, but anyways if you DO want to then this SO thread should help you
How to use same terminal window after using "rails server" command?
Hope you understood
use:
rails server -d
to start the server as daemon.

Resources