I get error below when I hit git push heroku master.
remote: Tasks: TOP => assets:precompile
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to xxx
remote:
To https://git.heroku.com/xxx.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/xxx.git'
My gem file is below.
source 'https://rubygems.org'
ruby '2.3.0'
gem 'rails_12factor', group: :production
gem 'bootstrap-sass'
gem 'rails', '4.2.5.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :production, :staging do
gem 'unicorn'
end
group :development, :test do
gem 'capistrano'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rbenv'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'sqlite3'
end
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
I don't know why I got rejected to push my rails app to heroku. I think my Gemfile is alright though. if someone knows solutions for this. I would really appreciate.
The error indicates that there are changes which are newer than commits you have in local.
To solve this:
Pull merge heroku to your local first, then try push to heroku again
Push force to heroku if you are sure that your local is the newest one!
I'll add onto Heiu Pham's answer and say that in Heroku, you may have problems with pushing to the master branch (if you are behind in history for example). What you can do is to start a new branch using
git checkout -b tempbranch and then push using
git push heroku tempbranch
If you are absolutely sure there are no newer refs, you can try
git push heroku -f
If this still doesn't work, check $ heroku logs for a hint to what the problem may be.
Related
I'm new to ruby on rails and working on a project on AWS cloud9. I went through other posts on stackoverflow but still couldn't find the solution to solve the error below. I have tried bundle install, bundle update, git add Gemfile.lock, none of them worked for me.
ec2-user:~/environment/saasapp (master) $ git push heroku master
Counting objects: 7991, done.
Compressing objects: 100% (6447/6447), done.
Writing objects: 100% (7991/7991), 48.09 MiB | 47.95 MiB/s, done.
Total 7991 (delta 1044), reused 7778 (delta 967)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.4.1
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Some gems seem to be missing from your vendor/cache directory.
remote: Could not find pg-0.18.4 in any of the sources
remote: Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Some gems seem to be missing from your vendor/cache directory.
remote: Could not find pg-0.18.4 in any of the sources
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to radiant-tor-65852.
remote:
To https://git.heroku.com/radiant-tor-65852.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/radiant-tor-65852.git'
Here is the gem file:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.4.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 4.3'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
# Use Twitter Bootstrap library for front-end UI and layout
gem 'bootstrap-sass', '3.3.7'
# Use Font Awesome sass gem for adding icons
gem 'font-awesome-sass', '~> 5.0.13'
# Use Hirb for better db display in console
gem 'hirb', '0.7.3'
group :development, :test do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :production do
# Use the PostgreSQL gem for heroku production servers
gem 'pg', '~> 0.20.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15', '< 4.0'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
OK, I got the solution.
First, type this command line:
sudo yum install /usr/include/libpq-fe.h
Then:
bundle install --with production
Worked for me!
I'm a noob to this stuff. I just deployed a different app prior to this one so I don't know if that could be the reason. Anyway, I did the standard Heroku steps to deploy but I am getting the following error:
remote: /tmp/build_70ac51f84d237880d076a5b324fee21c/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to glacial-island-90844.
remote:
To https://git.heroku.com/glacial-island-90844.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/glacial-island-90844.git'
Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
gem 'sqlite3'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
Heroku Logs:
2018-06-16T11:26:38.801026+00:00 app[api]: Release v1 created by user sbeezynen#gmail.com
2018-06-16T11:26:38.801026+00:00 app[api]: Initial release by user sbeezynen#gmail.com
2018-06-16T11:26:38.953219+00:00 app[api]: Enable Logplex by user sbeezynen#gmail.com
2018-06-16T11:26:38.953219+00:00 app[api]: Release v2 created by user sbeezynen#gmail.com
2018-06-16T11:28:14.000000+00:00 app[api]: Build started by user sbeezynen#gmail.com
2018-06-16T11:28:49.000000+00:00 app[api]: Build failed -- check your build logs
2018-06-16T11:33:13.000000+00:00 app[api]: Build started by user sbeezynen#gmail.com
2018-06-16T11:33:48.000000+00:00 app[api]: Build failed -- check your build logs
Any idea what could be causing this? I can see the heroku app from the Heroku Dashboard. I already did the 'git add -A' 'git commit' and 'git push' too.
There may be some CSS or JS which were enable to compile by precompiler of Heroku(Ruby on Rails). So first try to compile the files locally with enabling production mode and see if it is compiling or not if not then look for the errors it throwing. If not then it must be some configuration issue on heroku.
You can validate your css file or code on given
link
If any error in code then it's show or highlight on line number.
Here is the terminal result: So the error with language detention problem is with the command "$ git push heroku master"
tom100j:~/workspace/hello_app (master) $ git push heroku master
Counting objects: 133, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (118/118), done.
Writing objects: 100% (133/133), 24.39 KiB | 0 bytes/s, done.
Total 133 (delta 27), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect
the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to murmuring-stream-98615.
remote:
To https://git.heroku.com/murmuring-stream-98615.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to
'https://git.heroku.com/murmuring-stream-98615.git'
tom100j:~/workspace/hello_app (master) $
I have tried to go through what the problem is and even change the version of the ruby in the app. The gemfile is below.
source 'https://rubygems.org'
ruby "2.3.0"
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'rails', '~> 5.0.1'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test doconsole
gem 'sqlite3', '1.3.12'
gem 'byebug', platform: :mri
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby, :ruby]
group :production do
gem 'pg', '0.18.4'
end
Anybody hot solution for this?
Heroku couldn't detect the buildpack your application needs
Buildpacks are responsible for transforming deployed code into a slug, which can then be executed on a dyno.
First you should check if there's any buildpack set for the app by running, if theres none you should see the following message
$ heroku buildpacks
APP_NAME has no Buildpack URL set.
If there's a buildpack already selected you could remove it by issueing
$ heroku buildpacks:clear
Then manually set the buildpack for the application by running
$ heroku buildpacks:set heroku/ruby
Try to push the app again. If it continues to fail you should check
that the Gemfile.lock file contains a railties gem, and the gem version is greater than or equal to 5.0.0.beta, and less than 6.0.0. As suggested by Heroku Ruby Support for Rails 5.x applications
I am new to Ruby on Rails and I am faced with an error message every time I push my git files to Heroku.
The steps I have taken are:
heroku login
heroku keys:add
heroku create
git push heroku master
The error message is as follows:
Could not detect rake tasks
remote: ! ensure you can run `$ bundle exec rake -P` against your app
remote: ! and using the production group of your Gemfile.
remote: ! rake aborted!
Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to project1-app.
remote:
To https://git.heroku.com/project1-app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/project1-app.git'
Gem file:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
It looks like you have not updated your bundle may be after some editing in gem file. In order to make your bundle up-to date with your current gem file run below command
(1) bundle install
(2) bundle update
once your bundle is updated you can run
(3) heroku login
(4) heroku create
(5) git add .
(6) git commit -am "some comment"
(7) git push heroku master
(8) heroku open
I know this problem occured here couple times but I tried solutions from no one seems to work. I'm having a problem pushing an app to Heroku. So I type git push heroku master and this error occurs:
remote: An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Detected sqlite3 gem which is not supported on Heroku.
remote: ! https://devcenter.heroku.com/articles/sqlite3
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to sleepy-atoll-4840.
remote:
To https://git.heroku.com/sleepy-atoll-4840.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sleepy-atoll-4840.git'
This is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.4'
group :development do
gem 'sqlite3', '1.3.11'
end
gem 'sass-rails', '4.0.0.rc1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.18.1'
end
Any tip how to overcome this?
Heroku doesn't support SQLite
You need to keep it to your development group or similar:
#Gemfile
gem "pg", group: :production
gem "sqlite3", group: :development
--
As I see you have this already, you need to make sure your Gemfile.lock is set up correctly. The best way to do this is to run the following in your development environment:
$ bundle install --without production
$ bundle update
$ git add .
$ git commit -a -m "Gem"
$ git push heroku master
Heroku do not support sqlite3 in production...
You need to remove sqlite3 from your gem file and add the following.
From
gem 'sqlite3'
To
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Important: You will have to run
git add .
git commit
before running
git push heroku master