Import error while importing bootstrapJS file in react

Viewed 1177

I have downloaded all the packages given below and imported in App.js file

import 'bootstrap/dist/css/bootstrap.min.css'
import 'jquery/dist/jquery.min.js'
import '@popperjs/core/dist/cjs/popper.js'
import 'bootstrap/dist/js/bootstrap.min.js' // problem in this line 

If I import bootstrap/dist/js/bootstrap.min.js then it says

./node_modules/bootstrap/dist/js/bootstrap.min.js
Module not found: Can't resolve 'popper.js' in 'project_root\client\node_modules\bootstrap\dist\js'

Even if I copy and paste popper.js file in

'project_root\client\node_modules\bootstrap\dist\js'

It still shows the error.

1 Answers
npm install popper.js --save

Popper is a dependency required by bootstrap so you will need to install it.

Related