【问题标题】:POSTCSS - NPM Error Running NPM RUN PRODUCTIONPOSTCSS - NPM 错误运行 NPM RUN PRODUCTION
【发布时间】:2021-07-14 04:35:29
【问题描述】:

每当我尝试运行“npm run production”时,我都会收到以下错误。错误的其余部分只是出现此错误的“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,
          },
        },
      ],
    }),
  ],
});

感谢您的帮助!!

【问题讨论】:

    标签: node.js laravel vue.js npm postcss


    【解决方案1】:

    Trt postcss-rtlcss 包安装在 postcss-rtl

    最新版本(postcss@^8.0.0)

    npm install postcss-rtlcss --save-dev

    最新旧版 (postcss@^7.0.0)

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

    【讨论】:

      【解决方案2】:

      试试 autoprefixer:10.2.5 最新版本

      【讨论】:

      • 我尝试更新“autoprefixer”,但随后我必须更新很多其他软件包,包括“postcss-unprefix”
      猜你喜欢
      • 2020-11-17
      • 2021-03-03
      • 2021-04-10
      • 2019-03-28
      • 2019-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-15
      相关资源
      最近更新 更多