Rails-tutorial Chapter 1: rails server isn't working on Cloud9

后端 未结 4 588
说谎
说谎 2021-02-04 12:58

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

相关标签:
4条回答
  • 2021-02-04 13:29
    $ 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.

    0 讨论(0)
  • 2021-02-04 13:30

    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

    0 讨论(0)
  • 2021-02-04 13:39

    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.

    0 讨论(0)
  • 2021-02-04 13:41

    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

    0 讨论(0)
提交回复
热议问题