簡體   English   中英

POSTCSS - NPM 錯誤運行 NPM 運行生產

[英]POSTCSS - NPM Error Running NPM RUN PRODUCTION

每當我嘗試運行“ npm run production ”時,都會出現以下錯誤。 錯誤的 rest 只是出現此錯誤的“ node_modules ”包的列表。

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)

我相信錯誤出在“ autoprefixer ”和/或“ postcss- unprefix ”的版本中。 請在下面檢查我的“ devDependencies ”:

"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"
}

我注意到的另一件事是,如果我在“ webpack.mix.js ”中注釋掉以下行“ require('postcss-unprefix') 並運行“ npm run production ”,一切正常。

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

謝謝你的幫助!!

試試 autoprefixer:10.2.5 最新版本

trt postcss-rtlcss package insted of postcss-rtl

最新版本 (postcss@^8.0.0)

npm install postcss-rtlcss --save-dev

最新舊版本 (postcss@^7.0.0)

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM