Prasanga Thapaliya
Prasanga Thapaliya

Reputation: 737

Import error while importing bootstrapJS file in react

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.

Upvotes: 2

Views: 1650

Answers (1)

Jonathan Akwetey Okine
Jonathan Akwetey Okine

Reputation: 1295

npm install popper.js --save

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

Upvotes: 1

Related Questions