0

I've got a problem adding Bootstrap 4 RC6 to my Angular CLI project and I'm not sure what's going on - or how to describe it. My steps to create the project were as follows:

I've created a new project using Angular CLI with styles set to SASS using ng new My_New_Project --style=sass.

I've install node-sass using npm install node-sass --save-dev.

I've installed bootstrap 4 RC6 using npm install [email protected].

At this point I added @import '~bootstrap' to my existing styles.scss and I'm getting a weird error as follows:

ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss
Module build failed:
undefined
  ^
      Invalid CSS after "if": expected "{", was "(typeof jQuery === "
      in C:\<path>\node_modules\bootstrap\dist\js\bootstrap.js (line 7, column 4)
 @ ./src/styles.scss 4:14-189
 @ multi ./src/styles.scss

2 Answers 2

2

try import bootstrap like this

@import '~bootstrap/dist/css/bootstrap.css';

also check the file structure

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

Comments

0

First, you need to install bootstrap to your project. You can use the following command:

npm install bootstrap@latest --save

If you've already done installing the bootstrap, then use the following command to import it:

@import '~bootstrap/dist/css/bootstrap.min.css';

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.