Sass "Error: Can't find stylesheet to import." when importing bootstrap globally

Sass "Error: Can't find stylesheet to import." when importing bootstrap globally

When using

@import "bootstrap/scss/bootstrap"; 

in the styles.scss, I get the above error "Error: Can't find stylesheet to import."

Angular file structure:

--src
  --app
  --styles.scss
--angular.json

inside angular.json I have the following:

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

I tried changing the string to match the actual destination inside the node_modules.

Answer

I found the solution. @importis being deprecated and it is suggested to start utilizing @use .

Enjoyed this question?

Check out more content on our blog or follow us on social media.

Browse more questions