3

how i can use bootstrab 3 in angular 6 ?? it's not work in any way , i used :

npm install bootstrap@3 jquery --save

then update angular.json as follow :

"styles": [
          "src/styles.css",
          "../../node_modules/bootstrap/dist/css/bootstrap.min.css"

        ],
        "scripts": [
          "../../node_modules/jquery/dist/jquery.min.js",
          "../../node_modules/bootstrap/dist/js/bootstrap.min.js"
        ]

in html bootstrap class appear , but it dosen't work !! it's git this error

91% additional asset processing scripts-webpack-plugin× 「wdm」: Error: ENOENT: no such file or directory, open 'E:\node_modules\jquery\dist\jquery.min.js'
ammar ammary
  • 119
  • 1
  • 11

3 Answers3

2

INSTALL BOOTSTRAP (All bootstrap installed in node_module folder)

npm install bootstrap@3 jquery --save

Angular.json file

Add styles and scripts file to Angular.json for globalise

"styles": [
    "src/styles.css",
    "node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
    "node_modules/bootstrap/dist/js/bootstrap.min.js",
    "node_modules/jquery/dist/jquery.min.js"
]

component.html

<a class="btn btn-lg btn-primary" href="" role="button">View</a>
Arun
  • 63
  • 1
  • 4
0

To achieve expected result, update your node_modules location as below

"styles": [
              "src/styles.css",
              "../node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],
            "scripts": [
              "../node_modules/jquery/dist/jquery.min.js",
              "../node_modules/bootstrap/dist/js/bootstrap.min.js"
            ]

code sample - https://stackblitz.com/edit/angular-oyxshp?file=angular.json

Naga Sai A
  • 10,771
  • 1
  • 21
  • 40
0

i solve it

"styles": [
              "src/styles.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/bootstrap/dist/js/bootstrap.min.js"
            ]