skip to Main Content

I have been searching for hours, and it seems like a ton of people have this problem, then no one really gives a good answer.

And/or their answer doesn’t work for me (e.g., https://github.com/twbs/bootstrap/issues/35018 suggested to remove grid, which I did, still no luck).

I saw others talking about how its an issue with Post Css, and you have to remove specific syntax from your files (none of which were in my files) – e.g., ParserError: Syntax Error at line: 1, column 23.

Pretty lost on what to do next unfortunately.

literally just finished a multi-month build of a React App, and I go to deploy, and now I’ve been stuck on simply trying to run npm run build for like 3 hours </3

Anyone know how to resolve this problem?

**If I remove @import "~bootstrap/scss/bootstrap"; from my index.scss file, it allows me to build, but then breaks all my tempalting.

So Ideally looking for a solution that doesn’t require converting all my Sass code into standard CSS.

Appreciate the help!

$ npm run build

> [email protected] build
> react-scripts build

Creating an optimized production build...
Failed to compile.

./src/index.scss
ParserError: Syntax Error at line: 1, column 38

UPDATE TO INCLUDE SASS/BOOSTRAP VERESIONS

"sass": "^1.54.7"

"react-bootstrap": "^2.5.0"

"bootstrap": "^5.2.0"

Here’s my full package.json file:

{
  "name": "seo-workflows",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.10.0",
    "@emotion/styled": "^11.10.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@mui/icons-material": "^5.10.2",
    "@mui/material": "^5.10.2",
    "@mui/x-data-grid": "^5.16.0",
    "@pathofdev/react-tag-input": "^1.0.7",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "axios": "^0.27.2",
    "bootstrap": "^5.2.0",
    "downshift": "^6.1.9",
    "firebase": "^9.9.2",
    "react": "^17.0.2",
    "react-bootstrap": "^2.5.0",
    "react-dom": "^17.0.2",
    "react-fontawesome": "^1.7.1",
    "react-helmet": "^6.1.0",
    "react-icons": "^4.4.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "sass": "^1.54.7",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}


2

Answers


  1. Had the same problem. I had a bad path to

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

    and the error messages was not illuminating that the path was bad.

    To solve I started by commenting out all the @import files. Ran npm run build, success! Then one by one uncommented the files until I caught the one where the error was. For me the path was the error. Perhaps your’s if caused by a different error.

    Login or Signup to reply.
  2. Update you bootstrap, this work for me

       npm add [email protected]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search