CRA / PostCSS 8 - Cannot read properties of undefined (reading 'unprefixed')

Viewed 545

I have a little problem with postcss, i update this package because of audit issue.

First when i started my app, but i fixed this one by adding

"postcss-preset-env": "^7.2.3",

in my package.json resolutions.

But then, when i tried to build my app, i get the following one, and i dont find anything directly related to this specific

Cannot read properties of undefined (reading 'unprefixed')

complete error here:

https://evilmartians.com/chronicles/postcss-8-plugin-migration
cssnano-util-raw-cache: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
Failed to compile.⠂⸩ ⠧ : timing npm:load Completed in 32ms

Cannot read properties of undefined (reading 'unprefixed')
CompileError: Begins at CSS selector undefined


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm timing command:run-script Completed in 16564ms
npm timing npm Completed in 16715ms

i know it because of

"resolutions": {
  "postcss": "^8.2.13",
  ...
}

if i remove this, the error go away (but my 'yarn audit' rise vulnerabilities)

Can someone help me to understand the error? What kind of css issue can make this error? I found on google that sometimes, empty rules like

.myrules {
}

Can rise error, but not exactly the one i get, and even, i looked each scss file without finding empty rules.

my complete package.json:

{
  "name": "x",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@redux-offline/redux-offline": "^2.6.0",
    "@reduxjs/toolkit": "^1.6.2",
    "@testing-library/dom": "^8.11.1",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^27.0.3",
    "@types/node": "^12.0.0",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@types/react-router-dom": "^5.3.1",
    "@yaireo/tagify": "^4.9.5",
    "axios": "^0.24.0",
    "date-fns": "^2.28.0",
    "dompurify": "^2.3.3",
    "dotenv": "^10.0.0",
    "enzyme": "^3.11.0",
    "i18next": "^21.6.3",
    "i18next-browser-languagedetector": "^6.1.2",
    "i18next-parser": "^5.4.0",
    "jest-webpack-resolver": "^0.3.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.34",
    "react": "^17.0.2",
    "react-datepicker": "^4.6.0",
    "react-dom": "^17.0.2",
    "react-html-parser": "^2.0.2",
    "react-i18next": "^11.15.1",
    "react-redux": "^7.2.6",
    "react-router-dom": "^5.3.0",
    "react-scripts": "4.0.3",
    "react-test-renderer": "^17.0.2",
    "react-transition-group": "^4.4.2",
    "redux": "^4.1.1",
    "redux-mock-store": "^1.5.4",
    "redux-thunk": "^2.4.0",
    "sass": "^1.43.3",
    "typescript": "^4.1.2",
    "url-search-params-polyfill": "^8.1.1",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "REACT_APP_VERSION=$npm_config_vers REACT_APP_YMD=$npm_config_ymd REACT_APP_CUSTO=$npm_config_customer REACT_APP_ENV=$npm_config_env yarn startenv",
    "build": "REACT_APP_VERSION=$npm_config_vers REACT_APP_YMD=$npm_config_ymd REACT_APP_CUSTO=$npm_config_customer REACT_APP_ENV=$npm_config_env yarn buildenv",
    "startenv": "sh -ac '. .env.${REACT_APP_CUSTO}.${REACT_APP_ENV}; react-scripts start'",
    "buildenv": "sh -ac '. .env.${REACT_APP_CUSTO}.${REACT_APP_ENV}; react-scripts build'",
    "test": "jest test --watch --config=jest.config.js",
    "trans-extract": "i18next",
    "trans-convert-po-to-json": "node scripts/trans-po-to-json.js",
    "trans-convert-json-to-po": "node scripts/trans-json-to-po.js"
  },
  "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"
    ]
  },
  "devDependencies": {
    "@types/dompurify": "^2.3.1",
    "@types/enzyme": "^3.10.10",
    "@types/react-datepicker": "^4.3.4",
    "@types/react-html-parser": "^2.0.2",
    "@types/react-test-renderer": "^17.0.1",
    "@types/react-transition-group": "^4.4.4",
    "@types/redux-mock-store": "^1.0.3",
    "@types/yaireo__tagify": "^4.9.0",
    "@wojtekmaj/enzyme-adapter-react-17": "^0.6.5",
    "mock-local-storage": "^1.1.19",
    "ts-jest": "26.4.2"
  },
  "resolutions": {
    "node-forge": "^1.0.0",
    "browserslist": "^4.16.5",
    "glob-parent": "^5.1.2",
    "immer": "^9.0.6",
    "nth-check": "^2.0.1",
    "ansi-regex": "^5.0.1",
    "nanoid": "^3.1.31",
    "postcss": "^8.2.13",
    "postcss-preset-env": "^7.2.3",
    "follow-redirects": "^1.14.7"
  }
}
0 Answers
Related