https://www.railstutorial.org/book/beginning#sec-rails_server
I have reached this step, and I\'m using the cloud9 environment. When I run the server as per Listing 1.7 o
$ rails server -b $IP -p $PORT
Cloud9 uses the special environment variables $IP and $PORT to assign the IP address and port number dynamically. If you want to see the values of these variables, type echo $IP or echo $PORT at the command line.
It's likely that if you wait a few minutes (not more than 2), your OS will free up the port. If not, use a random port number over about 5,000 every time you run rails server
, e.g.
$ rails server -b $IP -p 6789
Or, because your IDE is so sucky, you might consider using a different IDE.
Probably you just had the other server still running. The one you initiate earlier on in he tutorial with the rails server
command. You need to shut the other one down first using Ctrl+C, then try rails server -b $IP -p $PORT
again
I ended up starting the tutorial from scratch again and it worked fine, but anyone with this problem in the future may find this troubleshooting technique I received from cloud9's support team useful:
Try:
lsof -i:8080
This will give the app that occupies it.
If apache, stop it using:
sudo /etc/init.d/apache2 stop
Hope this answer is of use to anyone with this problem.
I learned that you can use the command killall ruby
to stop any of the ruby processes which helped me because I had mistakenly run the rails server -b $IP -p $PORT
command at the ~/workspace
level in the tutorial. I found the answer in can't open rails server