skip to Main Content

While building my react app i got error as shown in picture and using "sass": "1.32.1" and bootstrap version 5.0.2. There is no any error while "npm start" but while building(npm run build in Jenkins), error occur.

Error Schreenshot

2

Answers


  1. Bootstrap 5.3.0 (latest at the moment) added support for dark and light modes.

    I have solved the same problem (although unrelated to ReactJS) by adding new bootstrap source file variables-dark.scss, after already existing variables.scss in my main site.scss file:

    // site.scss
    @import "../node_modules/bootstrap/scss/variables";
    @import "../node_modules/bootstrap/scss/variables-dark";
    

    More details can be found in Bootstrap Sass documentation for version 5.3 here.

    Other, perhaps easier option, if your ReactJS framework does not support Bootstrap 5.3 yet is to lock version of Bootstrap in package.json file to 5.2.x for now:

    "dependencies": {
      ...
      "bootstrap": "^5.2.0"
      ...
    },
    
    Login or Signup to reply.
  2. I think you need to specify Bootstrap version as 5.2.x, not above. Bootstrap 5.3 requires the import of scss/variables-dark

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search