陳炯安 陳炯安 - 2 months ago 23
Git Question

Why I get remote: sh: 2: Syntax error: Unterminated quoted string when I ran git push heroku master

I am using Rails 4.0.0.rc2 and Ruby 1.9.3 I have created application and I have push that application at GitHub repository by using git push.

When I attempt the git push heroku master command I get the following error:

C:\Sites\first_app>git push heroku master
Counting objects: 101, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (92/92), done.
Writing objects: 100% (101/101), 21.02 KiB, done.
Total 101 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: sh: 2: Syntax error: Unterminated quoted string
remote: !
remote: ! There was an error parsing your Gemfile, we cannot continue
remote: ! --- ERROR REPORT TEMPLATE ---------------------------------------------------
remote: ! - What did you do?
remote: !
remote: ! I ran the command `/tmp/d20151213-205-1wyxt7v/bundler-1.9.7/bin/b
undle check`
remote: !
remote: ! - What did you expect to happen?
remote: !
remote: ! I expected Bundler to...
remote: !
remote: ! - What happened instead?
remote: !
remote: ! Instead, what actually happened was...
remote: !
remote: !
remote: ! Error details
remote: !
remote: ! LocalJumpError: no block given (yield)
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/b
undler/dsl.rb:166:in `group'
remote: ! /tmp/build_2e1664b3e9f6ede5a8c91d27f6a70ce3/Gemfile:11:in `eval_gemfile'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/dsl.rb:32:in `instance_eval'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/dsl.rb:32:in `eval_gemfile'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/dsl.rb:10:in `evaluate'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/definition.rb:25:in `build'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler.rb:155:in `definition'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/cli/check.rb:11:in `run'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/cli.rb:103:in `check'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/cli.rb:10:in `start'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/bin/bundle:20:in `block in <top (required)>'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/gems/bundler-1.9.7/bin/bundle:18:in `<top (required)>'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/bin/bundle:23:in `load'
remote: ! /tmp/d20151213-205-1wyxt7v/bundler-1.9.7/bin/bundle:23:in `<main>'
remote: !
remote: ! Environment
remote: !
remote: ! Bundler 1.9.7
remote: ! Rubygems 2.4.5.1
remote: ! Ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
remote: ! GEM_HOME /tmp/build_2e1664b3e9f6ede5a8c91d27f6a70ce3/vendor/bundle
remote: ! GEM_PATH
remote: ! Git 1.9.1
remote: !
remote: ! Bundler settings
remote: !
remote: ! frozen
remote: ! Set for the current user (/app/.bundle/config): "1"
remote: ! path
remote: ! Set for the current user (/app/.bundle/config): "vendor/bundle"
remote: ! bin
remote: ! Set for the current user (/app/.bundle/config): "vendor/bundle/bin"
remote: ! jobs
remote: ! Set for the current user (/app/.bundle/config): "4"
remote: ! without
remote: ! Set for the current user (/app/.bundle/config): "development:test"
remote: ! disable_shared_gems
remote: ! Set for the current user (/app/.bundle/config): "1"
remote: ! gemfile
remote: ! Set via BUNDLE_GEMFILE: "/tmp/build_2e1664b3e9f6ede5a8c91d27f6a70ce3/Gemfile"
remote: ! --- TEMPLATE END ----------------------------------------------------------------
remote: !
remote: ! Unfortunately, an unexpected error occurred, and Bundler cannot continue.
remote: !
remote: ! First, try this link to see if there are any existing issue reports for this error:
remote: ! https://github.com/bundler/bundler/search?q=no+block+given+%28yield%29&type=Issues
remote: !
remote: ! If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
remote: ! https://github.com/bundler/bundler/issues/new
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to arcane-coast-8104.
remote:
To https://git.heroku.com/arcane-coast-8104.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/arcane-coast-8104.git


and when I using heroku open command

I got this page

heroku open

what is going on?

How can I able deploy to Heroku?

Below is my whole gemfile source

source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc2'

#Add Bootstrap for pretty UI
gem 'bootstrap-sass', '2.3.2'

# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: [:development, :test]
gem 'pg', group: :production
gem 'rails_12factor', group: :production

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0.rc2'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/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', '~> 1.2'

#force for now
gem 'sprockets', '=2.11.0'

gem 'heroku', '~> 3.42', '>= 3.42.25'

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]


My localhost screenshot
localhost:3000

Answer

It is likely that you have a .env file in your Heroku environment, which contains a variable declaration with an unterminated string. This is evaluated by dotenv and causes problems with your Gemfile.