{"record":{"id":"be26a5a07172f997","repo":"dianping/cat","slug":"bootstrap-s-javascript-requires-jquery","errorCode":null,"errorMessage":"Bootstrap's JavaScript requires jQuery","messagePattern":"Bootstrap's JavaScript requires jQuery","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"cat-home/src/main/webapp/assets/js/uncompressed/bootstrap.js","lineNumber":7,"sourceCode":"/*!\n * Bootstrap v3.2.0 (http://getbootstrap.com)\n * Copyright 2011-2014 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */\n\nif (typeof jQuery === 'undefined') { throw new Error('Bootstrap\\'s JavaScript requires jQuery') }\n\n/* ========================================================================\n * Bootstrap: transition.js v3.2.0\n * http://getbootstrap.com/javascript/#transitions\n * ========================================================================\n * Copyright 2011-2014 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)\n  // ============================================================\n\n  function transitionEnd() {\n    var el = document.createElement('bootstrap')","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/uncompressed/bootstrap.js#L1-L25","documentation":"Line 7 of bootstrap.js is a hard guard executed at file load: if the global jQuery symbol is undefined when bootstrap.js is evaluated, the whole script aborts with this error. Bootstrap 3 is a jQuery plugin and every component (defined via +function ($) {...}) needs $ to attach to $.fn, so it refuses to load without it.","triggerScenarios":"Loading bootstrap.js before jquery.js in the page; loading jQuery with a module loader (AMD/CommonJS misconfiguration) so no window.jQuery global exists; a typo'd jQuery script path so jQuery silently 404s; jQuery loaded with noConflict wiping the global after bootstrap's check but before use.","commonSituations":"Wrong script order in JSP/HTML templates (this repo serves assets from cat-home webapp); bundling/concatenation scripts that alphabetize files putting bootstrap before jquery; CDN jQuery blocked while local bootstrap loads; using jquery.slim under the assumption it is full jQuery (works here, but often confused).","solutions":["Ensure jQuery <script> tag appears before bootstrap.js and both paths resolve (check the Network tab for 404s).","If using a bundler, declare jquery as a dependency of bootstrap so order is guaranteed (require('jquery') before require('./bootstrap.js')).","Avoid jQuery.noConflict(true) removing the global before bootstrap loads, or load bootstrap via the same module scope.","Use jQuery 1.9.1–3.x compatible with Bootstrap 3.2.0 (it needs $.fn.emulateTransitionEnd era APIs)."],"exampleFix":"// before\n<script src=\"assets/js/uncompressed/bootstrap.js\"></script>\n<script src=\"assets/js/uncompressed/jquery.js\"></script>\n\n// after\n<script src=\"assets/js/uncompressed/jquery.js\"></script>\n<script src=\"assets/js/uncompressed/bootstrap.js\"></script>","handlingStrategy":"validation","validationCode":"if (typeof window.jQuery === 'undefined') {\n  console.error('jQuery missing: bootstrap.js will not load. Check script order/404s.');\n}","typeGuard":"function jqueryReady() { return typeof window.jQuery === 'function'; }","tryCatchPattern":null,"preventionTips":["Keep a single shared JSP/HTML template fragment that includes jquery.js before all jQuery-dependent scripts.","In bundlers, import jquery explicitly in each entry so dependency order is derived, not hand-written.","Add a CI check (or a simple grep of rendered HTML) that the jQuery script tag precedes bootstrap's."],"tags":["bootstrap","jquery","script-order","load-order","vendor"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}