Uncaught Error: Bootstrap’s JavaScript requires jQuery

Uncaught Error: Bootstrap’s JavaScript requires jQuery – Introduction When you utilize Bootstrap and add jQuery 1.x.x to build up your site, have you ever gotten the Uncaught Error: Bootstrap’s JavaScript requires jQuery error? If yes, do you know how to…

Uncaught error: bootstrap's javascript requires jquery

Uncaught Error: Bootstrap’s JavaScript requires jQuery – Introduction

When you utilize Bootstrap and add jQuery 1.x.x to build up your site, have you ever gotten the Uncaught Error: Bootstrap’s JavaScript requires jQuery error? If yes, do you know how to deal with the trouble? If you are looking for a useful solution, take a look at this blog. Today, we would like to bring you some methods to try so you can find the most suitable one.

How to fix the Uncaught Error: Bootstrap’s JavaScript requires jQuery?

First of all, make sure that you add jQuery before Bootstrap, since Bootstrap uses jQuery’s features. For example, if you are in a Browser-Only environment, then the right order you should try is:

<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/wow.min.js"></script>

Besides, in case you are in Node or CommonJS + Browser environment including Electron, Node-Webkit, etc., the main reason that causes the error is that jQuery’s export logic will check the module before the window:

if (typeof module === "object" && typeof module.exports === "object") {
// CommonJS/Node
} else {
// window
}

As it exports itself through the module.exports, both jQuery and $ won’t be assigned to the window. Therefore, you need to change <script src="path/to/jquery.js"></script>; into a require statement, such as:

<script>
window.jQuery = window.$ = require('jquery');
</script>

Last but not least, in case your Electron app doesn’t need nodeIntegration, simply set it to false. So, everything is done and you don’t need to use the solution above.

Final thoughts

In conclusion, we hope that some methods we suggested above will be useful for you. Don’t hesitate to try them to solve the trouble quickly. Do you have any other ideas for this issue? If so, why not share them with us by leaving your comment below? What’s more, we are providing a lot of high-quality free WordPress Themes, let’s visit our site and get the best one for your site.

Build it with a template

Start from a finished design: Joomla templates, WordPress themes or the AI-ready block themes. Every template has a free version and a live demo.

Free download

We'll send the link, setup tips and update notices, and you can reach us anytime through our AI assistant and contact form.

The download starts at once. We email you the link and ask you to confirm your address. Privacy policy.