Skip to content

Common Dev Environment Errors

Zeeshan Sarwar edited this page Dec 2, 2022 · 16 revisions

If you've encountered an error that's not listed here and was able to resolve it, please contribute to this document. It will help tons of people!

NOTE: Consider restarting your terminal if you're noticing multiple commands not working.

Table of Contents

Installation

Ruby

Error

Ruby Bundle Symbol not found: _SSLv2_client_method (LoadError)

Fix

rvm get stable
rvm reinstall ruby
rvm gemset pristine

Homebrew

Error

Requirements installation failed with status: 1. Failed to update Homebrew, follow instructions here: https://github.com/Homebrew/homebrew/wiki/Common-Issues and make sure brew update works before continuing.

Encountered while trying to run: rvm install ruby-2.3.4

Fix

Run brew update, this may lead to these errors:

Error: Error: /usr/local must be writable!

Fix: sudo chown -R $(whoami) /usr/local

Error: Error: update-report should not be called directly!

Fix: brew doctor

Error: Warning: Your Xcode (8.0) is outdated. Please update to Xcode 8.2 (or delete it). Xcode can be updated from the App Store.

Fix: xcode-select --install

RVM and Gems

Error

ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

Encountering errors while trying to run:

gem update --system
gem update

Fix

rvm use [email protected] --create`

libv8 and therubyracer (macOS 10.11+)

SSL (Windows)

Error

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Fix

Download the CURL CA bundle and set the environment variable SSL_CERT_FILE to point to it.

PostgreSQL Bad Connection

Error

PG::ConnectionBad (fe_sendauth: no password supplied )

Fix

You may need to create a new PSQL user. Follow this guide to define a username and password.

To keep this information private, list PSQL_USERNAME and PSQL_PASSWORD under config/env/test.env and config/env/development.env, then add username and password to config/database.yml:

You may also want to set PSQL_HOST="localhost" in config/env/test.env and config/env/development.env.

PostgreSQL Incompatible Version

Error

FATAL:  database files are incompatible with server
DETAIL:  The data directory was initialized by PostgreSQL version 9.4, which is
not compatible with this version 9.6.1.

Fix

  1. brew install [email protected]
  2. brew services start [email protected]
  3. Stop the server by running brew services stop [email protected].

PostgreSQL Connection Bad

Error

PG::ConnectionBad (could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
)

Fix

rm -rf /usr/local/var/postgres/postmaster.pid

Please note the below was done on Arch Linux, so adjust as neccessary

If the above does not work, try to restart the service. If the service refuses to start, it will most likely output a log using journalctl. View this by running journalctl -xe.

If the log reports that a file exists in /var/postgres/data, delete the file with super permissions. Recreate the server clusters:

sudo -iu postgres
initdb -D /var/lib/postgres/data

PostgreSQL Version Incompatible in macOS + Homebrew

Error

The data directory was initialized by PostgreSQL version 11, which is not compatible with this version 12.3.

Fix

brew postgresql-upgrade-database

Testing

Test Database Doesn't exist

Error

FATAL:  database "ifme_test" does not exist

Fix

bin/rake db:create db:migrate RAILS_ENV=test

Feature Tests on Windows using WSL

WSL by itself doesn't support a GUI yet so you can't use capybara to run feature/system specs in WSL terminal. You'll need to run it from a GUI environment to launch Chrome.

Make sure you install Google Chrome on WSL using the following:

Installing Chrome

sudo apt-get update
sudo apt-get install -y curl unzip xvfb libxi6 libgconf-2-4
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb

Check your chrome version:

google-chrome --version

Install Chromedriver (make sure you replace the version number in wget with your chrome's version)

wget https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver

You can check that chromedriver is installed and is using the correct version using the following:

chromedriver --version
which chromedriver # should be /usr/bin/chromedriver

Setting up WSL via RDP

sudo apt update && sudo apt -y upgrade
sudo apt -y install xfce4
sudo apt-get install xrdp
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
sudo /etc/init.d/xrdp start

In windows: run RDP, connect to localhost:3390, enter your username and password connecting to your WSL2 environment.

You should now be in a virtual GUI of your WSL2 environment. You can open up a terminal in there to run feature and system specs. Chrome will popup in that environment to test.

Running Dev Environment

Devise could not find the Warden::Proxy instance on your request environment.

Error

Error during failsafe response: Devise could not find the `Warden::Proxy` instance on your request environment.
21:30:29 web.1    | Make sure that your application is loading Devise and Warden as expected and that the `Warden::Manager` middleware is present in your middleware stack.
21:30:29 web.1    | If you are seeing this on one of your tests, ensure that your tests are either executing the Rails middleware stack or that your tests are using the `Devise::Test::ControllerHelpers` module to inject the `request.env['warden']` object for you.

Fix

You need to run Postgres in the background, if you're using macOS or Linux run postgres -D /usr/local/var/postgres

Create the development and test databases (MacOS Mojave)

Make sure to start Postgres first to avoid internal server error.

brew services start postgres

Then create the development test databases using the following command:

bin/rake db:setup db:test:prepare

Error

Sorry, you can't use byebug without Readline. To solve this, you need to
rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
install libreadline-dev` and then reinstall your Ruby.
rake aborted!

Fix

ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.7.dylib

https://github.com/deivid-rodriguez/byebug/issues/289#issuecomment-453943189

No such file or directory: 'install'

Error

== Installing npm packages ==
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'

Solution

Remove cmdtest and yarn:

sudo apt remove cmdtest
sudo apt remove yarn

Then install yarn globally using npm:

sudo npm install -g yarn

Or through the packaging tool:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update 
sudo apt-get install yarn

exec ./docker-entrypoint.sh: no such file or directory

While executing command docker-compose up you may get this error

Error

exec ./docker-entrypoint.sh: no such file or directory

Solution

Open this file ./docker-entrypoint.sh in VS Code and change the 'End of Line Sequence' from CRLF to LF and save the file then rerun docker-compose up command.

client.1 | sh: 1: bin/client.sh: not found

While executing command docker-compose up you may get this error

Error

 ifme-app-1  | 00h00m00s client.1 | sh: 1: bin/client.sh: not found

Solution

Open this file bin/client.sh in VS Code and change the 'End of Line Sequence' from CRLF to LF and save the file then rerun docker-compose up command.

App

Error screens when navigating to root, categories, or strategies screens while logged in

Problem

This is likely due to a lingering Category ID that is stored in a Strategy object. This used to occur when a Category object was destroyed while there was a Strategy object that stored the corresponding Category ID (a recent PR fixed this).

Fix

There is a rake task setup to clean your database to eliminate the issue. Simply run bundle exec rake cleaner:remove_lingering_categories.

Clone this wiki locally