heroku failing to deploy my app - ruby-on-rails

I am not able to push my rails app on heroku. Below is error message i get when i try to push rails app on heroku.
Ruby app detected Compiling Ruby/Rails sh: 1: Gemfile: not found ! !
There was an error parsing your Gemfile, we cannot continue ! !
[!] There was an error parsing Gemfile: syntax error, unexpected
':', expecting end-of-input - group: production do ! ^. Bundler
cannot continue. ! ! # from
/tmp/build_c114d933dd903e377866500bea22e827/Gemfile:50 ! #
------------------------------------------- ! # ! > group: production do ! # gem 'pg' ! #
------------------------------------------- ! ! Push rejected, failed to compile Ruby app.
This is what my gemfile looks like.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# 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

here was an error parsing Gemfile: syntax error, unexpected ':', expecting end-of-input - group: production
As above log...It is Just syntax error
group: production do
gem 'pg'
gem 'rails_12factor'
end
update it from
group :production do
gem 'pg'
gem 'rails_12factor'
end

Ok I figured it out. You are getting this error because of two mistakes you made in your gem file
(1) you forgot to define version of your gem 'byebug' in your gem file.
(2) you wrotegroup: production do which suppose to be group :production doI am pretty sure you will not be able to run your app locally either until you fix these both issues.
Add gem 'byebug', '3.4.0' in your gem file. you only have gem 'byebug' if you just add '3.4.0' secondly write group :production do instead of group: production do at 4th line from bottom of your gem file
once you add make these changes to your gem file make sure you run bundle install then bundle update
after successfully you do above process you can run below command to upload your app to heroku.
git init
git add .
git commit -am "some comment"
git push heroku master
heroku open

Related

I'm getting this error: Specified 'sqlite3' for database adapter, but the gem is not loaded

I am trying to run a Ruby on Rails app on Cloud 9 with the following command:
rails s -p $PORT -b $IP
and I'm getting an error that tells me I don't have sqlite3 in the gem file when I do. This only happened after I pushed my code to Heroku and now it doesn't run in the console any more.
I already tried 'bundle install' and 'bundle update', I also tried to manually install sqlite3 by running 'gem install sqlite3', none of these solved my problem. I also started going through all the steps all over again to see if that issue pops up again, and it does.
source 'https://rubygems.org'
ruby '2.4.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# 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 Haml as the templating library
gem 'haml'
# 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
gem 'themoviedb'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'guard-rspec'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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', '~> 0.21' # for Heroku deployment
gem 'rails_12factor'
end
(Posted on behalf of the question author).
I fixed it eventually, what happened was the version in Gemfile.lock was 'sqlite3 (1.4.0)' but the version I needed was 'sqlite3 (1.3.13)'. I changed the version and ran 'rake db:migrate' and 'rake db:seed' again and now it's working.
Your app is probably running the production environment on Heroku, but your Gemfile only includes sqlite3 in the development & test groups. Move sqlite3 out of the groups so that it is available in all environments and redeploy.
Something wrong with sqlite3 versions > 1.4.0 with Rails 5. Mention sqlite3 version explicitly in Gemfile with v1.3.11 or v1.3.13.
(gem 'sqlite3', '~> 1.3.11')

Ruby on Rails app deployed to heroku but Application error?

everyone actually i am new to ROR and struggling with debugging and especially reading and understanding heroku logs
I am using cloud 9 as an ide for development
I have made a basic note app and after successful build i deployed it to heroku but when i open the app link it says application error
can someone please help me out thank you !
Ruby version
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
Rails version
Rails 4.2.5
Gemfile
source 'https://rubygems.org'
ruby '2.5.1'
# 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 'bootstrap-sass', '~> 3.3.7'
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 -n 300
https://drive.google.com/file/d/1-evm_rnjGHiblHGckLmGwGcmOv5yBd6-/view?usp=sharing
thanks guys ! Sometimes the solution is really simple but it can't be sensed. I solved the issue just by adding version of pg gem in group production [gem 'pg', '~> 0.20']

Rails ghost error on production environment

I am deploying an app using rails, capistrano and nginx. In development environment all works good, even when debugging the app in another pc. But when i deploy the app to production environment i face some issues. When i open the browser i face the following classsic message: "We're sorry, but something went wrong". I tried to find something in /log/production.log but the file is empty, even after i gave write permissions to the project's folder. Additionaly, i tried to change the option consider_all_requests_local = true in /config/environments/production.rb but the message is still the same. The problem here is that i can't find the source of the error message. Even when i run 'rake test' in my development environment is everything fine. Here is my Gemfile and nginx log file (/var/log/nginx/error.log):
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# 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
gem 'rails-jquery-tokeninput'
gem 'mongoid', '~> 4.0.0'
gem 'bson_ext'
gem 'devise'
gem "recaptcha", require: "recaptcha/rails"
gem "mongoid-paperclip", :require => "mongoid_paperclip"
gem 'mini_magick', '~> 4.3'
gem 'simple_form'
gem 'country_select'
# twitter bootstrap css & javascript toolkit
gem 'twitter-bootswatch-rails', :github => ' scottvrosenthal/twitter-bootswatch-rails'
# twitter bootstrap helpers gem, e.g., alerts etc...
gem 'twitter-bootswatch-rails-helpers'
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem 'twitter-bootstrap-rails', :git => ' git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'mongo'
gem "sprockets", '3.6.3'
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'
#capistrano
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rails', '~> 1.1.3'
gem 'capistrano-rvm', github: "capistrano/rvm"
end
[ 2016-10-14 15:05:53.2730 53176/7f7d9072f700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/deploy/comigo_sn/current: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger.
Error ID: 2eeee637
Error details saved to: /tmp/passenger-error-ndXlo8.html
Message from application: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.<br>
<h2>Raw process output:</h2>
<pre>
*** ERROR ***: Cannot execute /home/deploy/.rvm/wrappers/ruby-2.3.1p112/ruby: No such file or directory (2)
</pre>
[ 2016-10-14 15:05:53.2840 53176/7f7d898f6700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 2-3] Cannot checkout session because a spawning error occurred. The identifier of the error is 2eeee637. Please see earlier logs for details about the error
I hope that somebody can help me to find the source of the problem. Can you help me to find how to find it?

Solidus Installation Failure

So Solidus is a fork of Spree and Spree is no longer maintained.
Am following the instructions on the Solidus's Github page (https://github.com/solidusio/solidus) to install it. And am stuck at this command bundle exec rails g spree:install this command raises the following error:
/Users/user1/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/handlebars_assets-0.19.1/lib/handlebars_assets.rb:20:in 'block in register_extensions': undefined method 'register_engine' for nil:NilClass (NoMethodError)
Not sure if this might help but before trying to install Solidus I was working on a Spree project.
Also, here is my Gemfile:
source 'https://rubygems.org'
# Solidus E-Commerce
gem 'solidus'
gem 'solidus_auth_devise'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# 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
Any help is really appreciated.
Update:
This is a known bug with handlebars-assets gem, which is resolved in master.
Adding the line :
gem 'handlebars_assets', github: 'leshill/handlebars_assets'
to your Gemfile will solve your problem until a new version contains the relevant fix.
Move the lines :
gem 'solidus'
gem 'solidus_auth_devise'
below gem 'rails', '4.2.4' because the former depends on the latter.
We've released a new version of solidus (v1.1.1) which locks sprockets-rails to 2.x to fix this issue.
https://github.com/solidusio/solidus/releases/tag/v1.1.1
In lieu of upgrading you can also specify the older sprockets-rails version in your Gemfile
gem "sprockets-rails", "~> 2.3"

web.1 | bundler: command not found: puma

I have a simple rails 4 app on my local machine and the Gemfile looks like this
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use postgresql as the database for Active Record
gem 'pg'
# 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
gem 'rails_12factor', group: :production
ruby "2.2.2"
However, when I run
heroku local web
I get the following error
==> heroku local web
forego | starting web.1 on port 5000
web.1 | bundler: command not found: puma
web.1 | Install missing gem executables with `bundle install`
Check your Procfile. It looks like the web service is configured to use the puma web server, but the puma gem is not on your Gemfile.
Add gem 'puma' to your Gemfile or use another web server.
I was having a really similar problem - My issue was that the 'puma' gem was called out in the "test" development section of my gem file. Moving this line of code, running bundle install and committing to git fixed it.

Resources