Heroku: Failed to install gems via Bundler
Follow steps -
Step 1: Remove Gemfile.lock from your project by manually or from following command -
rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock
Step 2: Then bundle install
Step 3: git add .
Step 4: git commit -m "commiting Gemfile.lock"
Step 5: git push heroku master -f
First do a "git pull" to merge, and then push again.or try to Execute this: rake assets:precompile git add . git commit -m "Add precompiled assets for Heroku" git push heroku master -f
to make sure you have install posgresSQL on your local by:
- on MAC:
brew install postgresql
- on Ubuntu:
sudo apt-get install libpq-dev
- RHEL systems:
yum install postgresql-devel
Start the postgres on your local
pg_ctl -D /usr/local/var/postgres start && brew services star postgresql
Let’s make sure Postgres is installed and running
postgres -V
Login to Postgresql on terminal
sudo -u postgres psql postgres
(You may need to provide the password 'root' )
Create userPostgres doesn’t actually directly manage users or groups, like most standard permission models do. Instead, it directly manages what it calls roles
CREATE ROLE testpostgres WITH LOGIN PASSWORD 'root';
Assign createDB permission to our new user
ALTER ROLE testpostgres CREATEDB;
Set password for new user
\password testpostgres
Create your DB
CREATE DATABASE yourDBName;
Used Postico (eggerapps.at/postico/) with UI to manage PostgresDB.
User user setup above to login to your DB via Postico.
- After logged in, you may see the image like below
Config your database.yml
Change all adapter :sqlite3 to adapter :postgresql
Provide the username and password login to DB by added two fields to your database.yml file like:
default: &default adapter: postgresql pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> host: localhost username: testpostgres password: root timeout: 5000
Fell free to put your DB name with the field database, like:
production: <<: *default database: railsapp
Run
rake db:create
rake db:migrate
Commit and push code to Heroku again. It should be Ok.
References links :
https://www.codementor.io/devops/tutorial/getting-started-postgresql-server-mac-osx