title: Error pushing to Heroku with Rails - sh: 2: Syntax error: Unterminated quoted string
body: <p>I'm using rails and trying to push my app to Heroku. I've made various apps before and never ran into this problem. I've spent hours searching for the cause of the problem and just cannot figure it out. I've ran bundle install, bundle update, removed Heroku .env variables, nothing helps. </p>
  
  <p>When I run <strong>git push heroku master</strong> I get the following error:</p>
  
  <pre><code>    git push heroku
      Counting objects: 24, done.
      Delta compression using up to 4 threads.
      Compressing objects: 100% (24/24), done.
      Writing objects: 100% (24/24), 4.10 KiB | 0 bytes/s, done.
      Total 24 (delta 14), reused 0 (delta 0)
      remote: Compressing source files... done.
      remote: Building source:
      remote:
      remote: -----&gt; Fetching set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
      remote: -----&gt; Ruby app detected
      remote: -----&gt; Compiling Ruby/Rails
      remote: -----&gt; Using Ruby version: ruby-2.2.4
      remote: -----&gt; Installing dependencies using bundler 1.11.2
      remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
      remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
      remote:        Fetching gem metadata from https://rubygems.org/...........
      remote:        Fetching version metadata from https://rubygems.org/...
      remote:        Fetching dependency metadata from https://rubygems.org/..
      remote:        Installing i18n 0.7.0
      remote:        Installing json 1.8.3 with native extensions
      remote:        Installing rake 11.2.2
      remote:        Installing minitest 5.9.0
      remote:        Installing thread_safe 0.3.5
      remote:        Installing builder 3.2.2
      remote:        Installing erubis 2.7.0
      remote:        Installing mini_portile2 2.1.0
      remote:        Installing pkg-config 1.1.7
      remote:        Installing rack 1.6.4
      remote:        Using bundler 1.11.2
      remote:        Installing mime-types-data 3.2016.0521
      remote:        Installing arel 6.0.3
      remote:        Installing thor 0.19.1
      remote:        Installing concurrent-ruby 1.0.2
      remote:        Installing execjs 2.7.0
      remote:        Installing sass 3.4.22
      remote:        Installing coffee-script-source 1.10.0
      remote:        Installing high_voltage 2.4.0
      remote:        Installing multi_json 1.12.1
      remote:        Installing turbolinks-source 5.0.0
      remote:        Installing libv8 3.16.14.15
      remote:        Installing pg 0.17.1 with native extensions
      remote:        Installing rails_serve_static_assets 0.0.5
      remote:        Installing rails_stdout_logging 0.0.4
      remote:        Installing ref 2.0.0
      remote:        Installing tilt 2.0.5
      remote:        Installing tzinfo 1.2.2
      remote:        Installing rdoc 4.2.2
      remote:        Installing nokogiri 1.6.8 with native extensions
      remote:        Installing rack-test 0.6.3
      remote:        Installing heroku-deflater 0.6.2
      remote:        Installing puma 2.11.1 with native extensions
      remote:        Installing mime-types 3.1
      remote:        Installing autoprefixer-rails 6.3.7
      remote:        Installing uglifier 3.0.0
      remote:        Installing sprockets 3.6.3
      remote:        Installing coffee-script 2.4.1
      remote:        Installing turbolinks 5.0.0
      remote:        Installing rails_12factor 0.0.2
      remote:        Installing therubyracer 0.12.2 with native extensions
      remote:        Installing activesupport 4.2.6
      remote:        Installing sdoc 0.4.0
      remote:        Installing mail 2.6.4
      remote:        Installing bootstrap-sass 3.3.6
      remote:        Installing loofah 2.0.3
      remote:        Installing rails-deprecated_sanitizer 1.0.3
      remote:        Installing globalid 0.3.6
      remote:        Installing activemodel 4.2.6
      remote:        Installing jbuilder 2.5.0
      remote:        Installing rails-html-sanitizer 1.0.3
      remote:        Installing rails-dom-testing 1.0.7
      remote:        Installing activejob 4.2.6
      remote:        Installing activerecord 4.2.6
      remote:        Installing actionview 4.2.6
      remote:        Installing actionpack 4.2.6
      remote:        Installing actionmailer 4.2.6
      remote:        Installing railties 4.2.6
      remote:        Installing sprockets-rails 3.1.1
      remote:        Installing coffee-rails 4.2.1
      remote:        Installing font-awesome-rails 4.6.3.1
      remote:        Installing jquery-rails 4.1.1
      remote:        Installing jquery-turbolinks 2.1.0
      remote:        Installing rails 4.2.6
      remote:        Installing sass-rails 5.0.5
      remote:        Installing animate-rails 1.0.10
      remote:        Bundle complete! 28 Gemfile dependencies, 66 gems now installed.
      remote:        Gems in the groups development and test were not installed.
      remote:        Bundled gems are installed into ./vendor/bundle.
      remote:        Post-install message from rdoc:
      remote:        Depending on your version of ruby, you may need to install ruby rdoc/ri data:
      remote:        &lt;= 1.8.6 : unsupported
      remote:        = 1.8.7 : gem install rdoc-data; rdoc-data --install
      remote:        = 1.9.1 : gem install rdoc-data; rdoc-data --install
      remote:        &gt;= 1.9.2 : nothing to do! Yay!
      remote:        Bundle completed (33.65s)
      remote:        Cleaning up the bundler cache.
      remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
      remote: sh: 2: Syntax error: Unterminated quoted string
      remote: sh: 2: Syntax error: Unterminated quoted string
      remote:  !
      remote:  !     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!
      remote:  !     LoadError: cannot load such file -- /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/config/application
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/Rakefile:4:in `require'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/Rakefile:4:in `&lt;top (required)&gt;'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load_rakefile'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:686:in `raw_load_rakefile'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:96:in `block in load_rakefile'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:95:in `load_rakefile'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:79:in `block in run'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/application.rb:77:in `run'
      remote:  !     /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/exe/rake:27:in `&lt;top (required)&gt;'
      remote:  !     vendor/bundle/bin/rake:16:in `load'
      remote:  !     vendor/bundle/bin/rake:16:in `&lt;main&gt;'
      remote:  !
      remote: /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3cf92a0d05bedd42cfe/lib/language_pack/helpers/rake_runner.rb:102:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
      remote: ensure you can run `$ bundle exec rake -P` against your app
      remote: and using the production group of your Gemfile.
      remote: rake aborted!
      remote: LoadError: cannot load such file -- /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/config/application
      remote: /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/Rakefile:4:in `require'
      remote: /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/Rakefile:4:in `&lt;top (required)&gt;'
      remote: /tmp/build_0f0d17123ff56c25b8d1a82d83ea67c6/vendor/bundle/ruby/2.2.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load'
  
      remote:     from /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3cf92a0d05bedd42cfe/lib/language_pack/instrument.rb:17:in `block in instrument'
      remote:     from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
      remote:     from /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3cf92a0d05bedd42cfe/lib/language_pack/instrument.rb:16:in `instrument'
      remote:     from /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3cf92a0d05bedd42cfe/lib/language_pack/instrument.rb:35:in `trace'
      remote:     from /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3cf92a0d05bedd42cfe/bin/compile:11:in `&lt;main&gt;'
      remote:  !     Push rejected, failed to compile Ruby app.
      remote:
      remote:  !     Push failed
      remote: Verifying deploy...
      remote:
      remote: !   Push rejected to fast-dawn-92173.
      remote:
      To https://git.heroku.com/fast-dawn-92173.git
       ! [remote rejected] master -&gt; master (pre-receive hook declined)
      error: failed to push some refs to 'https://git.heroku.com/fast-dawn-92173.git'
  </code></pre>
  
  <p>and here is my gemfile</p>
  
  <pre><code>    source 'https://rubygems.org'
  
      gem 'rails'
      gem 'bootstrap-sass'
      gem 'sass-rails'
      gem 'therubyracer'
      gem 'uglifier', '&gt;= 1.3.0'
      gem 'coffee-rails'
      gem 'jquery-rails'
      gem 'turbolinks'
      gem 'jbuilder'
      gem 'sdoc', '0.4.0', group: :doc
      gem 'font-awesome-rails'
      gem 'high_voltage', '~&gt; 2.4.0'
      gem 'sprockets-rails', require: 'sprockets/railtie'
      gem 'jquery-turbolinks'
      gem 'animate-rails'
  
      group :development, :test do
          gem 'sqlite3'
          gem 'byebug'
          gem 'web-console'
          gem 'spring'
          gem 'better_errors'
          gem 'letter_opener'
      end
  
      group :test do
          gem 'minitest-reporters', '1.0.5'
          gem 'mini_backtrace',     '0.1.3'
          gem 'guard-minitest',     '2.3.1'
      end
  
      group :production do
          gem 'pg', '0.17.1'
          gem 'rails_12factor', '0.0.2'
          gem 'puma',           '2.11.1'
          gem 'heroku-deflater'
      end
  </code></pre>
  
  <p>Everything is working fine on localhost but just can't push to heroku. Please let me know if you need anything else. Any help would be great thanks!!</p>
  
  <p>As mentioned in a question it could be something to do with the .bundle/config. I deleted that which didn't changed anything, my output from bundle config is:</p>
  
  <pre><code>        Settings are listed in order of priority. The top value will be used.
      orig_path
      Set via BUNDLE_ORIG_PATH: "/Users/luisaczc/.rvm/gems/ruby-2.2.3/bin:/Users/luisaczc/.rvm/gems/ruby-2.2.3@global/bin:/Users/luisaczc/.rvm/rubies/ruby-2.2.3/bin:/usr/local/heroku/bin:/Users/luisaczc/.rbenv/shims:/Users/luisaczc/.rbenv/shims:/Users/luisaczc/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/luisaczc/.rvm/bin"
  
      orig_gem_path
      Set via BUNDLE_ORIG_GEM_PATH: "/Users/luisaczc/.rvm/gems/ruby-2.2.3:/Users/luisaczc/.rvm/gems/ruby-2.2.3@global"
  </code></pre>
  
  <p>Also here is my Gemfile.lock as requested: (Please note I had to remove a small part of the unimportant heroku push error messages as I had used the maximum stack overflow body chars)</p>
  
  <pre><code>  GEM
      remote: https://rubygems.org/
      specs:
        actionmailer (4.2.7)
          actionpack (= 4.2.7)
          actionview (= 4.2.7)
          activejob (= 4.2.7)
          mail (~&gt; 2.5, &gt;= 2.5.4)
          rails-dom-testing (~&gt; 1.0, &gt;= 1.0.5)
        actionpack (4.2.7)
          actionview (= 4.2.7)
          activesupport (= 4.2.7)
          rack (~&gt; 1.6)
          rack-test (~&gt; 0.6.2)
          rails-dom-testing (~&gt; 1.0, &gt;= 1.0.5)
          rails-html-sanitizer (~&gt; 1.0, &gt;= 1.0.2)
        actionview (4.2.7)
          activesupport (= 4.2.7)
          builder (~&gt; 3.1)
          erubis (~&gt; 2.7.0)
          rails-dom-testing (~&gt; 1.0, &gt;= 1.0.5)
          rails-html-sanitizer (~&gt; 1.0, &gt;= 1.0.2)
        activejob (4.2.7)
          activesupport (= 4.2.7)
          globalid (&gt;= 0.3.0)
        activemodel (4.2.7)
          activesupport (= 4.2.7)
          builder (~&gt; 3.1)
        activerecord (4.2.7)
          activemodel (= 4.2.7)
          activesupport (= 4.2.7)
          arel (~&gt; 6.0)
        activesupport (4.2.7)
          i18n (~&gt; 0.7)
          json (~&gt; 1.7, &gt;= 1.7.7)
          minitest (~&gt; 5.1)
          thread_safe (~&gt; 0.3, &gt;= 0.3.4)
          tzinfo (~&gt; 1.1)
        addressable (2.4.0)
        animate-rails (1.0.10)
          rails
        ansi (1.5.0)
        arel (6.0.3)
        autoprefixer-rails (6.3.7)
          execjs
        better_errors (2.1.1)
          coderay (&gt;= 1.0.0)
          erubis (&gt;= 2.6.6)
          rack (&gt;= 0.9.0)
        bootstrap-sass (3.3.6)
          autoprefixer-rails (&gt;= 5.2.1)
          sass (&gt;= 3.3.4)
        builder (3.2.2)
        byebug (9.0.5)
        coderay (1.1.1)
        coffee-rails (4.2.1)
          coffee-script (&gt;= 2.2.0)
          railties (&gt;= 4.0.0, &lt; 5.2.x)
        coffee-script (2.4.1)
          coffee-script-source
          execjs
        coffee-script-source (1.10.0)
        concurrent-ruby (1.0.2)
        debug_inspector (0.0.2)
        erubis (2.7.0)
        execjs (2.7.0)
        ffi (1.9.14)
        font-awesome-rails (4.6.3.1)
          railties (&gt;= 3.2, &lt; 5.1)
        formatador (0.2.5)
        globalid (0.3.6)
          activesupport (&gt;= 4.1.0)
        guard (2.14.0)
          formatador (&gt;= 0.2.4)
          listen (&gt;= 2.7, &lt; 4.0)
          lumberjack (~&gt; 1.0)
          nenv (~&gt; 0.1)
          notiffany (~&gt; 0.0)
          pry (&gt;= 0.9.12)
          shellany (~&gt; 0.0)
          thor (&gt;= 0.18.1)
        guard-minitest (2.3.1)
          guard (~&gt; 2.0)
          minitest (&gt;= 3.0)
        heroku-deflater (0.6.2)
          rack (&gt;= 1.4.5)
        high_voltage (2.4.0)
        i18n (0.7.0)
        jbuilder (2.5.0)
          activesupport (&gt;= 3.0.0, &lt; 5.1)
          multi_json (~&gt; 1.2)
        jquery-rails (4.1.1)
          rails-dom-testing (&gt;= 1, &lt; 3)
          railties (&gt;= 4.2.0)
          thor (&gt;= 0.14, &lt; 2.0)
        jquery-turbolinks (2.1.0)
          railties (&gt;= 3.1.0)
          turbolinks
        json (1.8.3)
        launchy (2.4.3)
          addressable (~&gt; 2.3)
        letter_opener (1.4.1)
          launchy (~&gt; 2.2)
        libv8 (3.16.14.15)
        listen (3.1.5)
          rb-fsevent (~&gt; 0.9, &gt;= 0.9.4)
          rb-inotify (~&gt; 0.9, &gt;= 0.9.7)
          ruby_dep (~&gt; 1.2)
        loofah (2.0.3)
          nokogiri (&gt;= 1.5.9)
        lumberjack (1.0.10)
        mail (2.6.4)
          mime-types (&gt;= 1.16, &lt; 4)
        method_source (0.8.2)
        mime-types (3.1)
          mime-types-data (~&gt; 3.2015)
        mime-types-data (3.2016.0521)
        mini_backtrace (0.1.3)
          minitest (&gt; 1.2.0)
          rails (&gt;= 2.3.3)
        mini_portile2 (2.1.0)
        minitest (5.9.0)
        minitest-reporters (1.0.5)
          ansi
          builder
          minitest (&gt;= 5.0)
          ruby-progressbar
        multi_json (1.12.1)
        nenv (0.3.0)
        nokogiri (1.6.8)
          mini_portile2 (~&gt; 2.1.0)
          pkg-config (~&gt; 1.1.7)
        notiffany (0.1.0)
          nenv (~&gt; 0.1)
          shellany (~&gt; 0.0)
        pg (0.17.1)
        pkg-config (1.1.7)
        pry (0.10.4)
          coderay (~&gt; 1.1.0)
          method_source (~&gt; 0.8.1)
          slop (~&gt; 3.4)
        puma (2.11.1)
          rack (&gt;= 1.1, &lt; 2.0)
        rack (1.6.4)
        rack-test (0.6.3)
          rack (&gt;= 1.0)
        rails (4.2.7)
          actionmailer (= 4.2.7)
          actionpack (= 4.2.7)
          actionview (= 4.2.7)
          activejob (= 4.2.7)
          activemodel (= 4.2.7)
          activerecord (= 4.2.7)
          activesupport (= 4.2.7)
          bundler (&gt;= 1.3.0, &lt; 2.0)
          railties (= 4.2.7)
          sprockets-rails
        rails-deprecated_sanitizer (1.0.3)
          activesupport (&gt;= 4.2.0.alpha)
        rails-dom-testing (1.0.7)
          activesupport (&gt;= 4.2.0.beta, &lt; 5.0)
          nokogiri (~&gt; 1.6.0)
          rails-deprecated_sanitizer (&gt;= 1.0.1)
        rails-html-sanitizer (1.0.3)
          loofah (~&gt; 2.0)
        rails_12factor (0.0.2)
          rails_serve_static_assets
          rails_stdout_logging
        rails_serve_static_assets (0.0.5)
        rails_stdout_logging (0.0.5)
        railties (4.2.7)
          actionpack (= 4.2.7)
          activesupport (= 4.2.7)
          rake (&gt;= 0.8.7)
          thor (&gt;= 0.18.1, &lt; 2.0)
        rake (11.2.2)
        rb-fsevent (0.9.7)
        rb-inotify (0.9.7)
          ffi (&gt;= 0.5.0)
        rdoc (4.2.2)
          json (~&gt; 1.4)
        ref (2.0.0)
        ruby-progressbar (1.8.1)
        ruby_dep (1.3.1)
        sass (3.4.22)
        sass-rails (5.0.5)
          railties (&gt;= 4.0.0, &lt; 6)
          sass (~&gt; 3.1)
          sprockets (&gt;= 2.8, &lt; 4.0)
          sprockets-rails (&gt;= 2.0, &lt; 4.0)
          tilt (&gt;= 1.1, &lt; 3)
        sdoc (0.4.0)
          json (~&gt; 1.8)
          rdoc (~&gt; 4.0, &lt; 5.0)
        shellany (0.0.1)
        simple_form (3.2.1)
          actionpack (&gt; 4, &lt; 5.1)
          activemodel (&gt; 4, &lt; 5.1)
        slop (3.6.0)
        spring (1.7.2)
        sprockets (3.6.3)
          concurrent-ruby (~&gt; 1.0)
          rack (&gt; 1, &lt; 3)
        sprockets-rails (3.1.1)
          actionpack (&gt;= 4.0)
          activesupport (&gt;= 4.0)
          sprockets (&gt;= 3.0.0)
        sqlite3 (1.3.11)
        therubyracer (0.12.2)
          libv8 (~&gt; 3.16.14.0)
          ref
        thor (0.19.1)
        thread_safe (0.3.5)
        tilt (2.0.5)
        turbolinks (5.0.0)
          turbolinks-source (~&gt; 5)
        turbolinks-source (5.0.0)
        tzinfo (1.2.2)
          thread_safe (~&gt; 0.1)
        uglifier (3.0.0)
          execjs (&gt;= 0.3.0, &lt; 3)
        web-console (3.3.0)
          activemodel (&gt;= 4.2)
          debug_inspector
          railties (&gt;= 4.2)
  
    PLATFORMS
      ruby
  
    DEPENDENCIES
      animate-rails
      better_errors
      bootstrap-sass (~&gt; 3.3, &gt;= 3.3.6)
      byebug
      coffee-rails
      font-awesome-rails
      guard-minitest (= 2.3.1)
      heroku-deflater
      high_voltage (~&gt; 2.4.0)
      jbuilder
      jquery-rails
      jquery-turbolinks
      letter_opener
      mini_backtrace (= 0.1.3)
      minitest-reporters (= 1.0.5)
      pg (= 0.17.1)
      puma (= 2.11.1)
      rails
      rails_12factor (= 0.0.2)
      sass-rails (~&gt; 5.0, &gt;= 5.0.5)
      sdoc (= 0.4.0)
      simple_form
      spring
      sprockets-rails
      sqlite3
      therubyracer
      turbolinks
      uglifier (&gt;= 1.3.0)
      web-console
  
    RUBY VERSION
       ruby 2.2.3p173
  
    BUNDLED WITH
       1.12.5
  </code></pre>