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:
- https://unix.stackexchange.com/questions/813/how-to-determine-where-an-environment-variable-came-from
- https://rvm.io/gemsets/deleting
- https://stackoverflow.com/questions/7905114/rails-bundle-clean
- https://stackoverflow.com/questions/61988172/error-while-running-rails-new-app-path-or-rails-help-bootsnaploadpathcac
- https://github.com/rails/rails/issues/15367
- https://github.com/Shopify/bootsnap/issues/250
- https://github.com/Shopify/bootsnap/issues/268
- https://github.com/rvm/rvm/issues/3645
- https://stackoverflow.com/questions/25389633/starting-out-with-ruby-bin-rails-no-such-file-or-directory
- https://stackoverflow.com/questions/24642895/creating-rspec-files-for-existing-model-beginner
- https://github.com/rails/rails/pull/37257
- https://github.com/algolia/jekyll-algolia/issues/131
- https://stackoverflow.com/questions/23039528/your-ruby-version-is-2-0-0-but-your-gemfile-specified-2-1-0
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
Then you can choose to use a different version with
rvm use 2.3.9
Or you can make it your default by typing
rvm --default use 2.6.3
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 127.0.0.1:9393 (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
The 9393 comes from the 127.0.0.1:9393 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:
COMMAND PID USER FD TYPE DEVICE
ruby 54321 user 26y IPv4 0x33maccraf83u4934
The PID # is what we care about. Enter the following code with the PID #
kill -9 54321
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)