Chinnu
Chinnu

Reputation: 304

TypeError: Cannot read property 'fn' of undefined in react js

I have installed the owl carousel(npm install react-owl-carousel2). While running the code it is displaying the below error.

TypeError: Cannot read property 'fn' of undefined
    eval
    ././src/owl.carousel.js?:1667:4
    eval
    ././src/owl.carousel.js?:1701:3
    (anonymous function)
    C:/xampp/htdocs/new-react/node_modules/react-owl-carousel2/lib/OwlCarousel.js:63
      60 | /* 1 */
      61 | /***/ function(module, exports) {
      62 | 
     63 |   eval("'

What do I need to do for 'fn' of undefined error?

Upvotes: 1

Views: 3866

Answers (2)

Mitesh K
Mitesh K

Reputation: 770

include this is plugin array path : Project\node_modules\react-scripts\config\webpack.config.js

     new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
        'window.jQuery': 'jquery',
      }),

Upvotes: 0

Anas M.I
Anas M.I

Reputation: 582

let owl_carousel = require('owl.carousel');
window.fn = owl_carousel;

https://github.com/OwlCarousel2/OwlCarousel2/issues/2537 https://github.com/OwlCarousel2/OwlCarousel2/issues/2206

Upvotes: 1

Related Questions