Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: The bootstrap modal plugin does not have its version defined ?!? #68

Open
nick123pig opened this issue Jun 19, 2018 · 5 comments

Comments

@nick123pig
Copy link

I've had an app running for a long time, but just started getting this error out of the blue

image

At first, it was breaking functionality in my app. I then moved data-confirm-modal to the bottom of my application.js and things started working again, but I'm still getting the error in the js console.

Here are all the pertinent files (I think)

## Gemfile
source 'https://rubygems.org'

gem 'aasm'
gem 'active_model_serializers'
gem 'activejob-retry'
gem 'acts-as-taggable-on'
gem 'aes'
gem 'animalcodes', git: 'https://github.com/crossblaim/animalcodes.git'
gem 'aws-sdk'
gem 'bootstrap-sass', '~> 3.1.1'
gem 'burgundy'
gem 'capistrano', '~> 2.15.9'
gem 'cells-rails'
gem 'cells-slim'
gem 'charlock_holmes'
gem 'coffee-rails'
gem 'delayed_job_active_record'
gem 'delayed_job_web'
gem 'devise'
gem 'devise-authy'
gem 'devise-encryptable'
gem 'devise_invitable', '~> 1.5.2'
gem 'enum_help'
gem 'enumerize'
gem 'escape_utils'
gem 'figaro'
gem 'flag_shih_tzu'
gem 'font-awesome-sass', '~> 4.5.0'
gem 'gon'
gem 'gretel'
gem 'httparty'
gem 'iconv'
gem 'jbuilder', '~> 2.4.0'
gem 'jquery-rails', '4.1'
gem 'json', '~> 1.8.3'
gem 'kaminari'
gem 'kaminari-bootstrap', '~> 3.0.1'
gem 'kaminari-cells'
gem 'nilify_blanks'
gem 'oj', '~> 2.12.14'
gem 'omniauth-google-oauth2', '~> 0.4.1'
gem 'paperclip', git: 'https://github.com/thoughtbot/paperclip.git'
gem 'paranoia', '~> 2.2'
gem 'pg'
gem 'pundit'
gem 'rack-cors', require: 'rack/cors'
gem 'rails', '4.2.9'
gem 'rails-observers', git: 'https://github.com/rails/rails-observers'
gem 'ranked-model'
gem 'ransack', '~> 1.8.8'
gem 'react-bootstrap-rails'
gem 'react-flux-rails'
gem 'react-rails', '~> 1.5.0'
gem 'redcarpet'
gem 'roadie-rails'
gem 'rollbar'
gem 'rubyXL'
gem 'rubyzip'
gem 'sass-rails', '~> 5.0', '>= 5.0.6'
gem 'schema_plus_views'
gem 'select2-rails'
gem 'simple_form'
gem 'slim-rails'
gem 'spreadsheet'
gem 'thin'
gem 'tinymce-rails'
gem 'uglifier'
gem 'underscore-rails'
gem 'whenever', require: false

# keep these at the bottom
gem 'data-confirm-modal', git: 'https://github.com/ifad/data-confirm-modal.git'

group :production do
  gem 'newrelic_rpm'
end

group :test, :development do
  gem 'annotate'
  gem 'fantaskspec'
  gem 'pry-byebug'
  gem 'rspec-rails', '~> 3.4.2'
end

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'foreman'
  gem 'letter_opener'
  gem 'quiet_assets'
  gem 'rubocop', '~> 0.37.2', require: false
end

group :test do
  gem 'capybara', '~> 2.6'
  gem 'capybara-email'
  gem 'database_cleaner'
  gem 'factory_girl_rails'
  gem 'poltergeist'
  gem 'shoulda-matchers'
  gem 'simplecov', require: false
  gem 'timecop'
  gem 'webmock'
end
## application.js
#= require jquery
#= require jquery_ujs
#= require bootstrap
#= require react
#= require react_ujs
#= require react-flux
#= require underscore
#= require react_bootstrap
#= require_tree ./components/shared
#= require_tree ./components/app
#= require ./pickadate/picker
#= require ./pickadate/picker.date
#= require ./pickadate/picker.time
#= require ./pickadate/legacy
#= require jsoneditor
#= require ./epiceditor.min
#= require select2
#= require_tree ./shared
#= require_tree ./application
#= require data-confirm-modal

Thanks!!

@joe4dev
Copy link

joe4dev commented Aug 15, 2018

Bootstrap introduced the modal version definition with 3.2.0: Modal.VERSION = '3.2.0'
https://github.com/twbs/bootstrap/blob/v3.2.0/js/modal.js#L33

=> Updating to Bootstrap >= 3.2.0 (or adding the VERSION definition) will fix the problem where data-confirm-modal fails to detect the Bootstrap version

joe4dev added a commit to sealuzh/cloud-workbench that referenced this issue Aug 15, 2018
* Add version definition into vendor bootstrap dist

See: ifad/data-confirm-modal#68 (comment)

Bootstrap introduced the modal version definition with 3.2.0: Modal.VERSION = '3.2.0'
https://github.com/twbs/bootstrap/blob/v3.2.0/js/modal.js#L33

=> Updating to Bootstrap >= 3.2.0 (or adding the VERSION definition) will fix the problem where data-confirm-modal fails to detect the Bootstrap version
joe4dev added a commit to sealuzh/cloud-workbench that referenced this issue Aug 16, 2018
* Add version definition into vendor bootstrap dist

See: ifad/data-confirm-modal#68 (comment)

Bootstrap introduced the modal version definition with 3.2.0: Modal.VERSION = '3.2.0'
https://github.com/twbs/bootstrap/blob/v3.2.0/js/modal.js#L33

=> Updating to Bootstrap >= 3.2.0 (or adding the VERSION definition) will fix the problem where data-confirm-modal fails to detect the Bootstrap version
@letungit90
Copy link

Add

<script>
  $.fn.modal.Constructor.VERSION = "3.2"
</script>

before <script src="/assets/data-confirm-modal.js"></script>

@RailsCod3rFuture
Copy link

any fix for bootstrap 5.0.0 beta?

@tagliala
Copy link
Member

Hi @RailsCod3rFuture , please use #83 for newer bootstrap support

@carmageddon888
Copy link

Hi I had upgraded to rails 5.2.8.1 from rails 4.2.11.
I too saw this error in browser console.

I was on v 1.6.3 of "data-confirm-modal" gem which was doing version check.
I downgraded to v 1.5.0 which did not have version check.

Did not saw the error. And also modal looked ok.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants