Encountered an error while using NPM Bootstrap Carousel: Uncaught TypeError - Super expression must be either null or a function

Currently using the NPM build of Bootstrap (with Gulp) for a custom WordPress theme, and I seem to be facing some issues. While I am new to Bootstrap, I have previous experience with WordPress and Gulp (primarily with Foundation).

Below is how I am including the Bootstrap files:

// Defining the path to Bootstrap files
const BOOTSTRAP = 'node_modules/bootstrap';

// Selecting Bootstrap components while removing those not needed for the project
const SOURCE = {
    scripts: [

        // Bootstrap core 
        BOOTSTRAP + '/dist/js/bootstrap.js',

        // Including specific components required for the project
        BOOTSTRAP + '/js/dist/carousel.js',

        // Adding custom JS here, which will be concatenated
        'assets/scripts/js/**/*.js'
        ],

    // SCSS files to be concatenated
    styles: ['assets/styles/scss/**/*.scss'],
};

Here's a snippet of my carousel markup:

<?php
    $testimonial_args = array(
        'post_type' => 'testimonial',
    );
    $testimonial_query =  new WP_Query( $testimonial_args );
?>
<div id="testimonial-carousel" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner">
<?php
    $testimonial_integer = 0;
    if ( $testimonial_query->have_posts() ) :
    while ( $testimonial_query->have_posts() ) : $testimonial_query->the_post(); $testimonial_integer++;?>
        <div class="carousel-item <?php if ( 1 === $testimonial_integer ) { echo 'active'; } ?>">
            <?php the_title(); ?>
            <?php echo get_field('position'); ?>
            <?php echo get_field('city_state'); ?>
            <?php the_content(); ?>
        </div>
    <?php
    endwhile;
    wp_reset_postdata();
    endif;
    ?>
    </div>
    <a class="carousel-control-prev" href="#testimonial-carousel" role="button" data-slide="prev">
        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
    </a>
    <a class="carousel-control-next" href="#testimonial-carousel" role="button" data-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
    </a>
</div>

Despite nothing significantly different in the setup, I'm encountering this console error:

scripts.js?ver=5.8.3:1 Uncaught TypeError: Super expression must either be null or a function
    at _inherits (scripts.js?ver=5.8.3:1:6106)
    at scripts.js?ver=5.8.3:1:77341
    at scripts.js?ver=5.8.3:1:84943
    at scripts.js?ver=5.8.3:1:76256
    at scripts.js?ver=5.8.3:1:76312

This error only appears when I include the carousel JS file. However, after reviewing the JS file, the error doesn't seem to be within it.

I came across a suggestion that updating to a newer version of Bootstrap could resolve this issue, but with NPM, I should already have the latest version. I even ran npm update just to be sure.

I suspect there might be another JS file that needs to be included, but I'm unsure of which one. Any insights would be greatly appreciated.

Answer №1

Originally working with version 5.1.3, I decided to revert back to 4.6.1 due to the absence of the util.js file in the former. Strangely, version 5.1.3 did not have the util.js file for some unknown reason. By including the util.js file prior to the carousel, everything worked perfectly!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Postgres.js Date Range query failing to fetch any results

Recently, I have been utilizing the Postgres.js npm module to interact with a PostgreSQL database Below is the code snippet for executing the query: let startDate = '2020-01-28 08:39:00'; let endDate = '2020-01-28 08:39:59'; let table ...

How can we manually trigger $(document).ready() from within the ready callback of head.js using jQuery?

I am in search of ways to enhance the loading speed of a web application, particularly one that encompasses numerous javascript files on every HTML page. My plan is to experiment with head.js on a specific page to observe if it has a positive impact on loa ...

Protractor: Decrease the magnification

Currently, I am working with protractor and facing the challenge of zooming out to 50%. Despite trying numerous solutions found on StackOverflow, none have successfully resolved the issue. Some attempted solutions include: browser.actions().keyDown(protra ...

Is there a way to iterate through two arrays simultaneously in React components?

Recently delving into the world of React, I am utilizing json placeholder along with axios to fetch data. Within my state, I have organized two arrays: one for posts and another for images. state = { posts : [], images : [] ...

How can I load data from the server into CKEditor in React.js once the data is loaded?

Need to make changes in my code for editing an article item: const [contentEditor, setContentEditor] = useState(null); useEffect(() => { async function getLoadData(){ setitem(""); setContentEditor("" ...

What is the best way to achieve line breaks in text that auto-wraps in JavaScript/PHP?

My resizable div contains text/sentences. As I adjust the size of the div, the text wraps itself to perfectly fit within the available space in the container div. Now, I am faced with the task of converting this dynamic text into an image using php and th ...

Do I need to provide my email and password while using the Firebase signInWithGoogle()?

After attaching the signInWithGoogle() method to a button within the form, instead of opening a popup window as expected, it prompts me to fill in the email and password fields. Below is the configuration file: import firebase from 'firebase/app' ...

Adding controllers dynamically to ng-includes allows for more flexibility and customization in

How can I dynamically change the controller for ng-include in AngularJS? In my application, users can create content pages along with controllers. I am able to adjust the ng-include source dynamically, but I am unsure of how to associate a new controller ...

Encountering the error message "Uncaught TypeError: Cannot read property 'addEventListener' of null with querySelector

I attempted using getElementsByClassName but encountered the same error, which is peculiar. I had to change <p id="trigger-overlay"> in my HTML to <p class="trigger-overlay"> error function toggleOverlay(){alert('fire');}; var tri ...

Tips for safeguarding your passwords across diverse authentication methods

Exploring a new project idea, I am interested in supporting the SASL Mechanisms for authentication, particularly PLAIN and DIGEST-MD5. I am curious about how to securely store users' passwords when implementing these two authentication methods. When ...

JavaScript heap ran out of memory near heap limit during mark-compacts, rendering the allocation ineffective, resulting in a failed Ionic 3 production build

While attempting to build a production version of my Ionic 3 app, I encountered the following error: "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory". To troubleshoot this issue, I duplicated the en ...

Retrieve the data attribute from a specific dropdown menu using jQuery

Here is the code snippet I am currently working with: $('.tmp-class').change(function() { $('.tmp-class option:selected').each(function() { console.log($('.tmp-class').data('type')); }) ...

JavaScript preloader function isn't functioning properly when paired with a button

I'm currently working on developing a preliminary landing page for my game using JavaScript. I have integrated a class that overlays my main content, and added an 'onclick' function named fadeOut() for my button in JavaScript. However, the f ...

Exploring the global document object within Next.js

We have been working on a project using nextjs and are facing an issue with changing the styling of a button upon click. Despite using document.getElementById, we are unable to change the styling no matter what we try. pages/index.js function Index() { ...

Creating a file solely for route definitions and then employing them within index.js

My index.js file contains the following routes: import { createRouter, createWebHistory } from '@ionic/vue-router'; import { RouteRecordRaw } from 'vue-router'; const routes = [{ path: '', redirect ...

Utilize JavaScript to submit the FORM and initiate the 'submit' Event

Hey there! Here's the code I've been working on: HTML : <html> <body> <form enctype="multipart/form-data" method="post" name="image"> <input onchange="test();" ...

Is there a way to first run my validate function and then proceed with sending my AJAX request upon clicking a button?

Hey there! I've got a dynamic table generated from a database. You can check out the table. I have all the necessary code in place, but what I really need is to ensure proper timing of execution for specific actions: 1) Verify if all mandatory fields ...

Extracting JSON Data into Text Boxes within jQuery UI Dialogs

Let me provide some context to my current issue. Due to the nature of the problem being work-related, I am unable to share much of the code. The task at hand involves working with a jQuery dialog. Essentially, I have a list of names displayed with a boots ...

JavaScript function to evaluate true conditions

I am encountering an issue while calling sub functions connected to if statements within my main function. Even though the sub functions are supposed to return true or false, the expected alerts are not appearing. if (functionAAA()){ alert("111 ...

Utilizing Immutable.js within React's Pure Components

Having some difficulty incorporating React PureComponents with Immutable.js. Take a look at this demonstration: https://codepen.io/SandoCalrissian/pen/QaEmeX The demo showcases 2 components being rendered. The first (NoramlPure) is a regular PureComponen ...