简体   繁体   中英

POSTCSS - NPM Error Running NPM RUN PRODUCTION

I'm getting the following error anytime I try to run ' npm run production '. The rest of the error is just a list of ' node_modules ' packages where this error also occur.

ERROR in ./resources/assets/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'unprefixed' of undefined at clearDecl (/Users/prusso/Sites/qut-match-my-skills/node_modules/postcss-unprefix/lib/clearDecl.js:13:30)

I believe the error is in the version of ' autoprefixer ' and/or ' postcss-unprefix '. Please check my ' devDependencies ' below:

"devDependencies": {
    "autoprefixer": "^8.6.3",
    "babel-eslint": "^8.2.6",
    "babel-polyfill": "^6.26.0",
    "browser-sync": "^2.24.5",
    "browser-sync-webpack-plugin": "2.0.1",
    "cross-env": "^5.2.0",
    "cssnano": "^3.10.0",
    "eslint": "^4.0.0",
    "eslint-plugin-vue": "^4.7.1",
    "laravel-mix": "^2.1.11",
    "postcss-unprefix": "^2.1.3",
    "prettier-eslint": "^8.8.2",
    "raw-loader": "^0.5.1"
},
"dependencies": {
    "@nextindex/next-scss": "^1.2.1",
    "animate-sass": "^0.8.2",
    "axios": "^0.18.0",
    "babel-core": "^6.26.3",
    "es6-promise": "^4.2.4",
    "family.scss": "^1.0.8",
    "lodash.compact": "^3.0.1",
    "lodash.get": "^4.4.2",
    "normalize.css": "^8.0.0",
    "portal-vue": "^1.3.0",
    "smoothscroll-polyfill": "^0.4.3",
    "uuid": "^3.3.2",
    "vue": "^2.5.16",
    "vue-parallaxy": "^1.1.1",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1",
    "vuex-persistedstate": "^2.5.4",
    "zeus-grid": "^8.2.0"
}

Other thing that I have noticed is that if I comment out the following line ' require('postcss-unprefix') ' inside ' webpack.mix.js ' and run ' npm run production ' everything works fine.

mix.options({
  postCss: [
    // require('postcss-unprefix'),
    require('autoprefixer')({
      browsers: '>0.1%',
    }),
    require('cssnano')({
      preset: [
        'default',
        {
          discardComments: {
            removeAll: true,
          },
        },
      ],
    }),
  ],
});

Thanks for your help!!

try autoprefixer:10.2.5 latest version

Trt postcss-rtlcss package insted of postcss-rtl

Latest version (postcss@^8.0.0)

npm install postcss-rtlcss --save-dev

Latest legacy version (postcss@^7.0.0)

npm install postcss-rtlcss@legacy --save-dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM