Trying to import Bootstrap on Next.JS but says "TypeError: Cannot read property 'jquery' of undefined"

I'm trying to import Bootstrap from a Next.js project. The order of my imports are:

import 'jquery';
import 'bootstrap';

I tried with another syntax...

require('jquery');
require('bootstrap');

But the result is the same...

TypeError: Cannot read property 'jquery' of undefined jQueryDetection /node_modules/bootstrap/dist/js/bootstrap.js:243:26

I inverted the position of the imports and don't work...

Im in index.js page

1 answer

  • answered 2020-02-13 04:59 Jatayu

    Check if you have jQuery installed. You can check it in your package.json. If it is not, install it.