How to Start Rails Server?

how do you run the local server i tried rails server and rails s

2 Likes

Hi @system7535659680,

What was the result of those commands? If you type rails server in the terminal and press Enter, the server should start.

I’ve been having the same problem. In the Ruby on Rails Lessons, the server always works (those use port 8000). In the Projects, the server sometimes doesn’t work (port 4001). I had to reload the page and try the first few steps several times before the server worked.

Another issue with rails server is that if I have to refresh the page for some reason, or I temporarily get disconnected from CC’s server, I am no longer able to start a rails server. I have had to then reset rails projects and start over if I want to preview the app.

This is the terminal output:


What happens it the server doesn’t start?

My server also doesn’t work. In broadway project it started only once and in Bolt Network not at all. A little bit frustrating beacuse i can’t see if i do everything right.

Same thing happened to me. I wondered if it was because I had to refresh after CC disconnected (on the last step, no less). So frustrating!

For those of you having issues getting the rails server running, I have a few tips that can help troubleshoot this common issue. I noticed that after a certain amount of time working on a project or having the server up and running, the CC would disconnect. I also noticed that other times, I wasn’t even able to start the server at all. I think the following tips would help with both situations.

First and foremost, make sure you are in the directory that you’re working on trying to run the server. You can check to see what directory you are in by typing “pwd” in the terminal. The second thing you want to make sure is that you run “bundle install” before running your server or better yet, after initializing your rails app to make sure the proper gems are installed. I noticed the server won’t run if the proper gems aren’t installed.

If you somehow are disconnected from the server while working in a directory and the command rails server or rails s -p 4001 or whatever isn’t working, make sure you type bundle install in the terminal once again and then try firing up the command. This has worked for me. Let me know if it helps :v:t2:

I’ve had this happen to me before as well. I simply check with pwd to make sure I’m in the directory because for some reason it takes me out of it. Once I cd my way into the directory I’m doing work in, I fire up bundle install and then run rails s -p 4001 to run the server.