1

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?

2
  • Can you share the code where you are using the carousel? Commented Feb 19, 2020 at 6:02
  • add jquery to your index.html, or declare it in the config file Commented Feb 19, 2020 at 6:09

2 Answers 2

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank u fr your reply.Where i need to type this code .In which file
The file in which you have imported the owl carousel
0

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.