title: Javascript not loading on heroku
body: <p>I am trying to deploy an application. My javascript is loading perfectly on development but it's not loading on the production. Even I am not getting any error in production. If someone needs more information please let me know.<br/>
  I have already tried the below command </p>
  
  <p><strong>heroku run rake assets:precompile --app my_app</strong></p>
  
  <p>Also I have tried alert() function it is also not working on heroku.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
              $(function() {
                  $(document).ready(function() {
                      $('.flexslider').flexslider({
                          animation: "fade",
                          slideshowSpeed: 4000,
                          animationSpeed: 600,
                          controlNav: false,
                          directionNav: true,
                          controlsContainer: ".flex-container" // the container that holds the flexslider
                      });
                  });
              });
          &lt;/script&gt;
  </code></pre>
  
  <p><strong>Gemfile</strong></p>
  
  <pre><code>source 'https://rubygems.org'
  
  git_source(:github) do |repo_name|
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
    "https://github.com/#{repo_name}.git"
  end
  
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '~&gt; 5.0.5'
  # Use postgresql as the database for Active Record
  gem 'pg', '~&gt; 0.18'
  # Use Puma as the app server
  gem 'puma', '~&gt; 3.7'
  # Use SCSS for stylesheets
  gem 'sass-rails', '~&gt; 5.0'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  # gem 'therubyracer', platforms: :ruby
  
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.2'
  # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
  gem 'turbolinks', '~&gt; 5'
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.5'
  # Use Redis adapter to run Action Cable in production
  # gem 'redis', '~&gt; 3.0'
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # 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', platforms: [:mri, :mingw, :x64_mingw]
    # Adds support for Capybara system testing and selenium driver
    gem 'capybara', '~&gt; 2.13'
    gem 'selenium-webdriver'
  end
  
  group :development do
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; anywhere in the code.
    gem 'web-console', '&gt;= 3.3.0'
    gem 'listen', '&gt;= 3.0.5', '&lt; 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', '~&gt; 2.0.0'
  end
  
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
  </code></pre>
  
  <p><strong>Gemfile.lock</strong></p>
  
  <pre><code>GEM
    remote: https://rubygems.org/
    specs:
      actioncable (5.0.6)
        actionpack (= 5.0.6)
        nio4r (&gt;= 1.2, &lt; 3.0)
        websocket-driver (~&gt; 0.6.1)
      actionmailer (5.0.6)
        actionpack (= 5.0.6)
        actionview (= 5.0.6)
        activejob (= 5.0.6)
        mail (~&gt; 2.5, &gt;= 2.5.4)
        rails-dom-testing (~&gt; 2.0)
      actionpack (5.0.6)
        actionview (= 5.0.6)
        activesupport (= 5.0.6)
        rack (~&gt; 2.0)
        rack-test (~&gt; 0.6.3)
        rails-dom-testing (~&gt; 2.0)
        rails-html-sanitizer (~&gt; 1.0, &gt;= 1.0.2)
      actionview (5.0.6)
        activesupport (= 5.0.6)
        builder (~&gt; 3.1)
        erubis (~&gt; 2.7.0)
        rails-dom-testing (~&gt; 2.0)
        rails-html-sanitizer (~&gt; 1.0, &gt;= 1.0.3)
      activejob (5.0.6)
        activesupport (= 5.0.6)
        globalid (&gt;= 0.3.6)
      activemodel (5.0.6)
        activesupport (= 5.0.6)
      activerecord (5.0.6)
        activemodel (= 5.0.6)
        activesupport (= 5.0.6)
        arel (~&gt; 7.0)
      activesupport (5.0.6)
        concurrent-ruby (~&gt; 1.0, &gt;= 1.0.2)
        i18n (~&gt; 0.7)
        minitest (~&gt; 5.1)
        tzinfo (~&gt; 1.1)
      addressable (2.5.2)
        public_suffix (&gt;= 2.0.2, &lt; 4.0)
      arel (7.1.4)
      bindex (0.5.0)
      builder (3.2.3)
      byebug (9.1.0)
      capybara (2.16.1)
        addressable
        mini_mime (&gt;= 0.1.3)
        nokogiri (&gt;= 1.3.3)
        rack (&gt;= 1.0.0)
        rack-test (&gt;= 0.5.4)
        xpath (~&gt; 2.0)
      childprocess (0.8.0)
        ffi (~&gt; 1.0, &gt;= 1.0.11)
      coffee-rails (4.2.2)
        coffee-script (&gt;= 2.2.0)
        railties (&gt;= 4.0.0)
      coffee-script (2.4.1)
        coffee-script-source
        execjs
      coffee-script-source (1.12.2)
      concurrent-ruby (1.0.5)
      crass (1.0.3)
      erubis (2.7.0)
      execjs (2.7.0)
      ffi (1.9.18)
      globalid (0.4.1)
        activesupport (&gt;= 4.2.0)
      i18n (0.9.1)
        concurrent-ruby (~&gt; 1.0)
      jbuilder (2.7.0)
        activesupport (&gt;= 4.2.0)
        multi_json (&gt;= 1.2)
      jquery-rails (4.3.1)
        rails-dom-testing (&gt;= 1, &lt; 3)
        railties (&gt;= 4.2.0)
        thor (&gt;= 0.14, &lt; 2.0)
      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.1.1)
        crass (~&gt; 1.0.2)
        nokogiri (&gt;= 1.5.9)
      mail (2.7.0)
        mini_mime (&gt;= 0.1.1)
      method_source (0.9.0)
      mini_mime (1.0.0)
      mini_portile2 (2.3.0)
      minitest (5.10.3)
      multi_json (1.12.2)
      nio4r (2.2.0)
      nokogiri (1.8.1)
        mini_portile2 (~&gt; 2.3.0)
      pg (0.21.0)
      public_suffix (3.0.1)
      puma (3.11.0)
      rack (2.0.3)
      rack-test (0.6.3)
        rack (&gt;= 1.0)
      rails (5.0.6)
        actioncable (= 5.0.6)
        actionmailer (= 5.0.6)
        actionpack (= 5.0.6)
        actionview (= 5.0.6)
        activejob (= 5.0.6)
        activemodel (= 5.0.6)
        activerecord (= 5.0.6)
        activesupport (= 5.0.6)
        bundler (&gt;= 1.3.0)
        railties (= 5.0.6)
        sprockets-rails (&gt;= 2.0.0)
      rails-dom-testing (2.0.3)
        activesupport (&gt;= 4.2.0)
        nokogiri (&gt;= 1.6)
      rails-html-sanitizer (1.0.3)
        loofah (~&gt; 2.0)
      railties (5.0.6)
        actionpack (= 5.0.6)
        activesupport (= 5.0.6)
        method_source
        rake (&gt;= 0.8.7)
        thor (&gt;= 0.18.1, &lt; 2.0)
      rake (12.3.0)
      rb-fsevent (0.10.2)
      rb-inotify (0.9.10)
        ffi (&gt;= 0.5.0, &lt; 2)
      ruby_dep (1.5.0)
      rubyzip (1.2.1)
      sass (3.5.4)
        sass-listen (~&gt; 4.0.0)
      sass-listen (4.0.0)
        rb-fsevent (~&gt; 0.9, &gt;= 0.9.4)
        rb-inotify (~&gt; 0.9, &gt;= 0.9.7)
      sass-rails (5.0.7)
        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)
      selenium-webdriver (3.8.0)
        childprocess (~&gt; 0.5)
        rubyzip (~&gt; 1.0)
      spring (2.0.2)
        activesupport (&gt;= 4.2)
      spring-watcher-listen (2.0.1)
        listen (&gt;= 2.7, &lt; 4.0)
        spring (&gt;= 1.2, &lt; 3.0)
      sprockets (3.7.1)
        concurrent-ruby (~&gt; 1.0)
        rack (&gt; 1, &lt; 3)
      sprockets-rails (3.2.1)
        actionpack (&gt;= 4.0)
        activesupport (&gt;= 4.0)
        sprockets (&gt;= 3.0.0)
      thor (0.20.0)
      thread_safe (0.3.6)
      tilt (2.0.8)
      turbolinks (5.0.1)
        turbolinks-source (~&gt; 5)
      turbolinks-source (5.0.3)
      tzinfo (1.2.4)
        thread_safe (~&gt; 0.1)
      uglifier (4.0.2)
        execjs (&gt;= 0.3.0, &lt; 3)
      web-console (3.5.1)
        actionview (&gt;= 5.0)
        activemodel (&gt;= 5.0)
        bindex (&gt;= 0.4.0)
        railties (&gt;= 5.0)
      websocket-driver (0.6.5)
        websocket-extensions (&gt;= 0.1.0)
      websocket-extensions (0.1.3)
      xpath (2.1.0)
        nokogiri (~&gt; 1.3)
  
  PLATFORMS
    ruby
  
  DEPENDENCIES
    byebug
    capybara (~&gt; 2.13)
    coffee-rails (~&gt; 4.2)
    jbuilder (~&gt; 2.5)
    jquery-rails
    listen (&gt;= 3.0.5, &lt; 3.2)
    pg (~&gt; 0.18)
    puma (~&gt; 3.7)
    rails (~&gt; 5.0.5)
    sass-rails (~&gt; 5.0)
    selenium-webdriver
    spring
    spring-watcher-listen (~&gt; 2.0.0)
    turbolinks (~&gt; 5)
    tzinfo-data
    uglifier (&gt;= 1.3.0)
    web-console (&gt;= 3.3.0)
  
  BUNDLED WITH
     1.15.4
  </code></pre>
  
  <p><strong>production.rb</strong></p>
  
  <pre><code>Rails.application.configure do
    # Settings specified here will take precedence over those in config/application.rb.
  
    # Code is not reloaded between requests.
    config.cache_classes = true
  
    # Eager load code on boot. This eager loads most of Rails and
    # your application in memory, allowing both threaded web servers
    # and those relying on copy on write to perform better.
    # Rake tasks automatically ignore this option for performance.
    config.eager_load = true
  
    # Full error reports are disabled and caching is turned on.
    config.consider_all_requests_local       = false
    config.action_controller.perform_caching = true
  
    # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
    # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
    # `config/secrets.yml.key`. 
    config.read_encrypted_secrets = true
  
    # Disable serving static files from the `/public` folder by default since
    # Apache or NGINX already handles this.
    config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
  
    # Compress JavaScripts and CSS.
    config.assets.js_compressor = :uglifier
    # config.assets.css_compressor = :sass
  
    # Do not fallback to assets pipeline if a precompiled asset is missed.
    config.assets.compile = true
    config.serve_static_assets = true
  
    # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
  
    # Enable serving of images, stylesheets, and JavaScripts from an asset server.
    # config.action_controller.asset_host = 'http://assets.example.com'
  
    # Specifies the header that your server uses for sending files.
    # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
    # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
  
    # Mount Action Cable outside main process or domain
    # config.action_cable.mount_path = nil
    # config.action_cable.url = 'wss://example.com/cable'
    # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
  
    # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
    # config.force_ssl = true
  
    # Use the lowest log level to ensure availability of diagnostic information
    # when problems arise.
    config.log_level = :debug
  
    # Prepend all log lines with the following tags.
    config.log_tags = [ :request_id ]
  
    # Use a different cache store in production.
    # config.cache_store = :mem_cache_store
  
    # Use a real queuing backend for Active Job (and separate queues per environment)
    # config.active_job.queue_adapter     = :resque
    # config.active_job.queue_name_prefix = "my_bagicha_#{Rails.env}"
    config.action_mailer.perform_caching = false
  
    # Ignore bad email addresses and do not raise email delivery errors.
    # Set this to true and configure the email server for immediate delivery to raise delivery errors.
    # config.action_mailer.raise_delivery_errors = false
  
    # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
    # the I18n.default_locale when a translation cannot be found).
    config.i18n.fallbacks = true
  
    # Send deprecation notices to registered listeners.
    config.active_support.deprecation = :notify
  
    # Use default logging formatter so that PID and timestamp are not suppressed.
    config.log_formatter = ::Logger::Formatter.new
  
    # Use a different logger for distributed setups.
    # require 'syslog/logger'
    # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
  
    if ENV["RAILS_LOG_TO_STDOUT"].present?
      logger           = ActiveSupport::Logger.new(STDOUT)
      logger.formatter = config.log_formatter
      config.logger    = ActiveSupport::TaggedLogging.new(logger)
    end
  
    # Do not dump schema after migrations.
    config.active_record.dump_schema_after_migration = false
  end
  </code></pre>
  
  <p><strong>application.js</strong></p>
  
  <pre><code>// This is a manifest file that'll be compiled into application.js, which will include all the files
  // listed below.
  //
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
  // vendor/assets/javascripts directory can be referenced here using a relative path.
  //
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
  // compiled file. JavaScript code in this file should be added after the last require_* statement.
  //
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
  // about supported directives.
  //
  //= require jquery
  //= require jquery_ujs
  //= require_tree .
  </code></pre>