title: Uncaught TypeError: Object.defineProperty called on non-object on Heroku
body: <p>I am making a Rails app, which runs without any errors on local, but gives me the following error in the developer tool on Heroku.
  <a href="https://i.stack.imgur.com/KfgIt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KfgIt.png" alt="enter image description here"></a></p>
  
  <p>Here is the <code>Gemfile</code></p>
  
  <pre><code>    source 'https://rubygems.org'
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
  
  ruby '2.4.4'
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '~&gt; 5.2.0'
  gem 'bootstrap-sass', '3.3.7'
  gem 'jquery-rails'
  gem "font-awesome-rails"
  # Use Puma as the app server
  gem 'puma', '~&gt; 3.11'
  # 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 'duktape'
  # 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'
  # 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; 4.0'
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # Use ActiveStorage variant
  # gem 'mini_magick', '~&gt; 4.8'
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  # Reduces boot times through caching; required in config/boot.rb
  gem 'bootsnap', '&gt;= 1.1.0', require: false
  
  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]
    # Use sqlite3 as the database for Active Record
    gem 'sqlite3'
  end
  
  group :development do
    # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
    gem 'web-console', '&gt;= 3.3.0'
  end
  
  group :production do
    gem 'pg', '&gt;= 0.18', '&lt; 2.0'
  end
  
  group :test do
    # Adds support for Capybara system testing and selenium driver
    gem 'capybara', '&gt;= 2.15', '&lt; 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]
  </code></pre>
  
  <p>Here is <code>application.js</code></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 rails-ujs
  //= require activestorage
  //= require turbolinks
  //= require_tree
  //= require jquery2
  //= require bootstrap-sprockets
  </code></pre>
  
  <p>What I know now is that changing the position of <code>//= require jquery2</code> to the top of the list can result in the following error.
  <a href="https://i.stack.imgur.com/mZ8gl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mZ8gl.png" alt="enter image description here"></a></p>
  
  <p>And also, the Rails app from <a href="https://github.com/bodrovis/jquery-slick-rails-demo" rel="nofollow noreferrer">this website</a> will work without any errors.</p>
  
  <p>Let me know if you need to know some other information to solve this.</p>