DEV Community


Posted on • Updated on

Day 17 : #100DaysofCode - Knowing your Ruby Version & what Errno::EADDRINUSE means is important!

Today I focused on my project and updated my code for my assessment so I do not have any "new" content for my #100DaysofCode although I did code a lot today. Instead, I wanted to write about some of the random issues I have come across while using terminal.

I had a huge issue with running rails, but not for the reasons you may believe. I kept getting an error message when trying to run rails new APP_PATH, I added my error to the following stackoverflow error:

Then I researched like crazy:

Long story short: The error was, I was on the wrong ruby version -_____-

If you ever have that error you should try checking what version you are using by running the following:

rvm list
Enter fullscreen mode Exit fullscreen mode

Then you can choose to use a different version with

rvm use 2.3.9
Enter fullscreen mode Exit fullscreen mode

Or you can make it your default by typing

rvm --default use 2.6.3
Enter fullscreen mode Exit fullscreen mode

I am glad I was able to learn how to check my Ruby versions and hope to save someone in the future from going down the same rabbit hole that I did.

Another "issue" you may come across while coding is "Address already in use - bind(2) for (Errno::EADDRINUSE)"

This usually means that the localhost that you are using is already in use. To fix this you should run the following code in your terminal:

lsof -wni tcp:9393
Enter fullscreen mode Exit fullscreen mode

The 9393 comes from the code that was given in the "error" message. So you should update it with the numbers you see on your terminal.

If inputted correctly, you will see something similar to this:

ruby 54321 user 26y IPv4 0x33maccraf83u4934

The PID # is what we care about. Enter the following code with the PID #

kill -9 54321
Enter fullscreen mode Exit fullscreen mode

That will essentially kill all terminal processes using that PID #.

You should now be able to run on your localhost using the path you were attempting to use before.

Hope this helps.

Song of the day:

Top comments (0)