0

i'm using vue cli . I have installed bootstrap using npm install bootstrap command. i have successfully imported @import "../node_modules/bootstrap/dist/css/bootstrap.min.css" ; on vue component but when i include script <script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script> on index.html before closing body tag its not working.

3 Answers 3

1

Import the bootstrap js file just in main.js just like you did with the css file. So add import 'bootstrap' to the main.js.

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

5 Comments

unable to add @import "../node_modules/bootstrap/dist/js/bootstrap.min.js"; on main .js please share real example
How did you setup your project, did you use vue cli?
yes everything is default vue cli i have app.vue and component folder by default . in addition i have just install bootstrap using npm install bootstrap . but do not know how to add bootstrap.min.js
Take a look at this article: travishorn.com/…
i am still not find solution. but give you point . if found comment me
0

Install bootstrap using npm

npm install bootstrap

Edit src/main.js file of your app. Import like this.

import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min.js'

Comments

0

This also happened to me. I did a lot of searching, but no one had the right answer.

I used Bootstrap v5.3.3 and Vue3. I had no idea why it works :D.

Just Remove any bootstrap/boostrap.bundle.min.js import either in main.js or index.html.

All you need is to import the bootsrap.min.css ONLY on your main.js and boom it's working properly, including the dropdown, accordion, etc.

I even remove popperjs its still working fine.

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.