Reputation: 83
Hi i hav latest angular cli in my machine. i have tried to install bootstrap on angular project. These are the steps i have followed .
Then open the project in vs codein the angular.json file i copy below code.
"styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.min.js", "../node_modules/bootstrap/dist/js/bootstrap.js" ]
after that i run the project ng serve i got this error msg.
Angular Live Development Server is listening on localhost: 4200, open your browser on http://localhost:4200/ ** 91% additional asset processing scripts-webpack-plugin× 「wdm」: Error: ENOENT: no such file or directory, open 'D:\Angular\node_modules\jquery\dist\jquery.min.js'
Upvotes: 4
Views: 3791
Reputation: 11
Place your command line on your project, then run:
npm install bootstrap@next
Then, go your ide go to Angular.json and type at styles:
"styles": [ "node_modules/bootstrap/dist/css/bootstrap.css", "src/styles.css" ]
Do the same for the scripts:
"scripts": [ "node_modules/bootstrap/dist/js/bootstrap.min.js" ]
Upvotes: 0
Reputation: 12036
CLI projects in angular 6 onwards will be using angular.json
instead of .angular-cli.json
for build and project configuration.
Each CLI workspace has projects, each project has targets, and each target can have configurations.Docs
. {
"projects": {
"my-project-name": {
"projectType": "application",
"architect": {
"build": {
"configurations": {
"production": {},
"demo": {},
"staging": {},
}
},
"serve": {},
"extract-i18n": {},
"test": {},
}
},
"my-project-name-e2e": {}
},
}
In your angular.json add the file paths to the styles and scripts array in under build
target with ./
instead of ../
Boostrap 4 does not support Glyphicons anymore, you can use Font Awesome instead:
Execute npm install --save font-awesome
and addd file path to the styles array
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ng6",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css","./node_modules/bootstrap/dist/css/bootstrap.min.css"
"./node_modules/font-awesome/css/font-awesome.css"
],
"scripts": ["./node_modules/jquery/dist/jquery.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js"]
},
Upvotes: 3