Reputation: 65
I've added bootstrap to an Angular app created with Angular-CLI
(ng new), after adding bootstrap
to the project and referencing it from my .angular-cli.json
file - ng serve
wouldn't run.
ERROR LOG
ERROR in multi ./src/styles.css C:/server/node_modules/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'C:\server\node_modules\bootstrap\dist\css\bootstrap.css' in 'C:\dev\mean\ems-mean\client\node_mod
ules\@angular\cli\models\webpack-configs'
resolve 'C:\server\node_modules\bootstrap\dist\css\bootstrap.css' in 'C:\dev\mean\ems-mean\client\node_modules\@angular\cli\models\webpac
k-configs'
using description file: C:\dev\mean\ems-mean\client\node_modules\@angular\cli\package.json (relative path: ./models/webpack-configs)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\dev\mean\ems-mean\client\node_modules\@angular\cli\package.json (relative path: ./models/webpack-confi
gs)
No description file found
no extension`enter code here`
Field 'browser' doesn't contain a valid alias configuration
C:\server\node_modules\bootstrap\dist\css\bootstrap.css doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\server\node_modules\bootstrap\dist\css\bootstrap.css.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\server\node_modules\bootstrap\dist\css\bootstrap.css.js doesn't exist
as directory
C:\server\node_modules\bootstrap\dist\css\bootstrap.css doesn't exist
[C:\server\node_modules\bootstrap\dist\css\bootstrap.css\package.json]
[C:\server\node_modules\bootstrap\dist\css\bootstrap.css]
[C:\server\node_modules\bootstrap\dist\css\bootstrap.css.ts]
[C:\server\node_modules\bootstrap\dist\css\bootstrap.css.js]
[C:\server\node_modules\bootstrap\dist\css\bootstrap.css]
@ multi ./src/styles.css C:/server/node_modules/bootstrap/dist/css/bootstrap.css
Upvotes: 1
Views: 653
Reputation: 5416
The problem is that you can't provide the absolute addresses to the module, try this:
"../node_modules/bootstrap/dist/css/bootstrap.css"
Upvotes: 1