nuxt 2: postcss-preset-env: 未知特性: “customProperties”, 你是指: “custom-properties” 吗?

huangapple go评论91阅读模式
英文:

nuxt 2: postcss-preset-env: Unknown feature: "customProperties", did you mean: "custom-properties"

问题

我最近的Nuxt项目不再编译:

警告  编译时出现1个警告

警告  在/build/components/nuxt-error.vue?vue&type=style&index=0&id=2b6db950&lang=css& 中

模块警告(来自./node_modules/postcss-loader/dist/cjs.js):
警告

(1:1) postcss-preset-env: 未知特性:“customProperties”,你是不是想说:“custom-properties”

@ ./node_modules/vue-style-loader??ref--3-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!/build/components/nuxt-error.vue?vue&type=style&index=0&id=2b6db950&lang=css& 4:14-352 15:3-20:5 16:22-360
@ /build/components/nuxt-error.vue?vue&type=style&index=0&id=2b6db950&lang=css&
@ /build/components/nuxt-error.vue
@ /build/index.js
@ /build/client.js
@ multi ./node_modules/eventsource-polyfill/dist/browserify-eventsource.js (webpack)-hot-middleware/client.js?reload=true&timeout=30000&ansiColors=&overlayStyles=&path=%2Fmon-espace%2F__webpack_hmr%2Fclient&name=client /build/client.js


错误  编译失败,出现1个错误

未找到此相对模块:

* ./index.vue?vue&type=style&index=0&id=a00a9554&scoped=true&lang=scss& 在 ./pages/my_path/_slug/index.vue 中

有人遇到这个错误吗?我已经进行了很多调查,尝试升级依赖项,但没有成功。

这是我的当前配置:

    "nuxt": "^2.16.2",
    "sass": "^1.59.3",
    "vue": "^2.7.14"
英文:

I've recently had my nuxt project not compiling anymore:

WARN  Compiled with 1 warnings

WARN  in /build/components/nuxt-error.vue?vue&type=style&index=0&id=2b6db950&lang=css&

Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
Warning

(1:1) postcss-preset-env: Unknown feature: "customProperties", did you mean: "custom-properties"

@ ./node_modules/vue-style-loader??ref--3-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!/build/components/nuxt-error.vue?vue&type=style&index=0&id=2b6db950&lang=css& 4:14-352 15:3-20:5 16:22-360
@ /build/components/nuxt-error.vue?vue&type=style&index=0&id=2b6db950&lang=css&
@ /build/components/nuxt-error.vue
@ /build/index.js
@ /build/client.js
@ multi ./node_modules/eventsource-polyfill/dist/browserify-eventsource.js (webpack)-hot-middleware/client.js?reload=true&timeout=30000&ansiColors=&overlayStyles=&path=%2Fmon-espace%2F__webpack_hmr%2Fclient&name=client /build/client.js


ERROR  Failed to compile with 1 errors

This relative module was not found:

* ./index.vue?vue&type=style&index=0&id=a00a9554&scoped=true&lang=scss& in ./pages/my_path/_slug/index.vue

Anyone has this error? I have been investigating quite a lot, trying to upgrade dependencies, without success.

Here's my current config:

    "nuxt": "^2.16.2",
    "sass": "^1.59.3",
    "vue": "^2.7.14"

答案1

得分: 1

好的,我之前在我的nuxt.config.js文件中保留了这个配置:

  build: {
    postcss: {
      preset: {
        features: {
          customProperties: false,
        }
      }
    },
  },

当我升级我的nuxt版本时,这导致了失败。

当然,这个配置不是在主配置文件中,而是在一些子导入的文件中。不然我会更快地注意到它,但无论如何!

英文:

Ok my bad, I had this config remaining in my nuxt.config.js file:

  build: {
    postcss: {
      preset: {
        features: {
          customProperties: false,
        }
      }
    },
  },

which made it fail when I upgraded my nuxt version.

Of course it was not in the main config file but in some sub-imported file otherwise I would have seen it quicker but whatever!

huangapple
  • 本文由 发表于 2023年3月15日 19:42:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744235.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定