Reputation: 9345
I try to push my Rails app to Heroku using git push heroku master -f
command and I get this:
Total 0 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.9.7
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: You have added to the Gemfile:
remote: * rails (= 4.2.0)
remote: * sass-rails (= 5.0.2)
remote: * uglifier (= 2.5.3)
remote: * coffee-rails (= 4.1.0)
remote: * jquery-rails (= 4.0.3)
remote: * turbolinks (= 2.3.0)
remote: * jbuilder (= 2.2.3)
remote: * sdoc (= 0.4.0)
remote: * sqlite3 (= 1.3.9)
remote: * byebug (= 3.4.0)
remote: * web-console (= 2.0.0.beta3)
remote: * spring (= 1.1.3)
remote: * pg (= 0.17.1)
remote: * rails_12factor (= 0.0.2)
remote: You have deleted from the Gemfile:
remote: * byebug
remote: * coffee-rails (~> 4.1.0)
remote: * jbuilder (~> 2.0)
remote: * jquery-rails
remote: * rails (= 4.2.1)
remote: * sass-rails (~> 5.0)
remote: * sdoc (~> 0.4.0)
remote: * spring
remote: * sqlite3
remote: * turbolinks
remote: * uglifier (>= 1.3.0)
remote: * web-console (~> 2.0)
remote: Bundler Output: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: You have added to the Gemfile:
remote: * rails (= 4.2.0)
remote: * sass-rails (= 5.0.2)
remote: * uglifier (= 2.5.3)
remote: * coffee-rails (= 4.1.0)
remote: * jquery-rails (= 4.0.3)
remote: * turbolinks (= 2.3.0)
remote: * jbuilder (= 2.2.3)
remote: * sdoc (= 0.4.0)
remote: * sqlite3 (= 1.3.9)
remote: * byebug (= 3.4.0)
remote: * web-console (= 2.0.0.beta3)
remote: * spring (= 1.1.3)
remote: * pg (= 0.17.1)
remote: * rails_12factor (= 0.0.2)
remote:
remote: You have deleted from the Gemfile:
remote: * byebug
remote: * coffee-rails (~> 4.1.0)
remote: * jbuilder (~> 2.0)
remote: * jquery-rails
remote: * rails (= 4.2.1)
remote: * sass-rails (~> 5.0)
remote: * sdoc (~> 0.4.0)
remote: * spring
remote: * sqlite3
remote: * turbolinks
remote: * uglifier (>= 1.3.0)
remote: * web-console (~> 2.0)
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to theorderapp.
remote:
To https://git.heroku.com/theorderapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/theorderapp.git'
I try to bundle update
and bundle install
again and run git push heroku master -f
but it's still not working.
I also try delete my Gemfile.lock file, run bundle update
and bundle install
again, git add
and git commit
it and run git push heroku master -f
but it also not working for me.
This is my Gemfile btw:
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'bootstrap-sass', '3.2.0.0'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
gem 'font-awesome-sass'
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
And this is my .gitignore file:
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
Upvotes: 3
Views: 8422
Reputation: 79
to make sure you have install posgresSQL on your local by:
brew install postgresql
sudo apt-get install libpq-dev
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 user Postgres 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.
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
Upvotes: 0
Reputation: 46960
I'm pretty sure it's that you don't specify the ruby version in your gemfile. I believe Heroku needs this. So it's using ruby 2.0 as the heroku default and then trying to load gems for 1.9.7 as the bundler default.
If this is right, specifying the ruby version number in the gemfile will fix the problem. See http://devcenter.heroku.com/articles/ruby-versions
Upvotes: -1
Reputation: 1535
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
Upvotes: 9
Reputation: 146
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
Upvotes: 0