You attempted to start up a server, only to be confronted with the following error:
Address already in use - bind(2) for "0.0.0.0" port 3000 (Errno::EADDRINUSE)
What do you do?
- Figure out what service is using that address port.
You attempted to start up a server, only to be confronted with the following error:
Address already in use - bind(2) for "0.0.0.0" port 3000 (Errno::EADDRINUSE)
What do you do?
To access the rails console in a docker container, run:
docker-compose run web rails console
So, you just cloned an existing project's repo and you run bundle install
but you got the error: rbenv: version
x.x.x is not installed...
.
What the issue means? The project uses a specific ruby version that you do not have on your system.
Here's how to fix it:
rbenv install x.x.x
Ref: https://stackoverflow.com/questions/24622568/rails-generate-model-hangs
So, I ran into a mysterious situation where running a rails g migration ...
command on my terminal freezes/hangs for a really long time.
Running ps aux | grep spring
gave me a clue into what was going on.
I got the following:
esther 4201 0.0 0.0 2480224 2692 ?? S 6Sep17 0:00.82 spring server | panacea | started 191 hours ago
This is useful for when debugging your tests.
Option 1:
puts page.body
Option 2:
save_and_open_page
Today I learnt about jq - "a lightweight and flexible command-line JSON processor".
One of the use cases is pretty-printing JSON response on the terminal.
It essentially makes JSON data more readable on your terminal. If you work with a lot of JSON data on your terminal, you need to install jq
.
Before jq
:
$ curl localhost:3001/api/food?q=hash+browns
I have multiple verstions of rails and ruby gems on my machine and I ran into the error below when I tried to run any rails command such as rails -v
, rails new new_app
, etc.
.../ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate activesupport-5.1.0, already activated activesupport-5.0.1 (Gem::LoadError)
Here's how I fixed it.
The version conflict points to ActiveSupport
so I ran the command below to check the different versions of activesupport
on my machine:
I had a challenge with pushing to another heroku account from my command line...
These are the steps I took to fix the error (redacted) below:
! Your account [email protected] does not have access to xx-heroku-app.
!
! SSH Key Fingerprint: xx:xx:xx...
fatal: Could not read from remote repository.
If you're installing puma version below 3.7 or 3.8, because puma requires openssl, you'll get the following error when you attempt to install the puma gem either directly or from a Gemfile:
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
current directory: /Users/esther/.rbenv/versions/2.3.0/gemsets/contagious/gems/puma-2.6.0/ext/puma_http11
/Users/esther/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20170830-2950-8i5exi.rb extconf.rb
creating Makefile