javascript - Vue CLI - 未找到 PostCSS 配置

我有一个 package.json 是这样的:

{
  "name": "dashboard",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "apexcharts": "^3.8.4",
    "axios": "^0.19.0",
    "core-js": "^2.6.5",
    "lodash": "^4.17.15",
    "moment": "^2.24.0",
    "vue": "^2.6.10",
    "vue-apexcharts": "^1.5.1",
    "vue-numerals": "^3.0.5",
    "vue-router": "^3.1.3",
    "vue-virtual-scroll-list": "^1.4.4",
    "vuetify": "2.1.13",
    "vuex": "^3.1.2",
    "vuex-map-fields": "^1.3.6",
    "vuex-persist": "^2.2.0"
  },
  "devDependencies": {
    "@mdi/font": "^3.8.95",
    "@vue/cli-plugin-babel": "^3.9.0",
    "@vue/cli-plugin-eslint": "^3.9.0",
    "@vue/cli-service": "^3.9.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "sass": "^1.17.4",
    "sass-loader": "^7.1.0",
    "typeface-roboto": "^0.0.75",
    "vue-cli-plugin-vuetify": "^2.0.5",
    "vue-template-compiler": "^2.6.10",
    "vuetify-loader": "^1.2.2"
  }
}

当我通过 Vue cli 为这个项目进行设置时,我选择了将 Eslint、Babel 等选项封装在 package.json 中。我现在将它们放在几个文件中:.eslintrc.jsbabel.config.jspostcss.config.js。我可以这样做吗 - 创建这些文件并从 package.json 中删除内容?

postcss.config.js 的内容是这样的:

module.exports = {
    plugins: {
        autoprefixer: {},
    },
};

当我构建这个时,我总是收到这样的消息:

Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: No PostCSS Config found in: /Users/dev/Sites/dev/src/node_modules/vuetify/src/directives/ripple
    at /Users/dev/Sites/dev/src/resources/views/dashboard/node_modules/postcss-load-config/src/index.js:91:15

 @ /Users/dev/Sites/dev/src/node_modules/vuetify/src/directives/ripple/VRipple.sass 4:14-329 14:3-18:5 15:22-337

在此之前,我在顶部看到了这条消息:

65% building 852/919 modules 67 active /Users/dev/Sites/dev/src/resources/views/dashboard/node_modules/axios/lib/core/transformData.jsYou did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.

这是否意味着我也需要使用 postcss.config.js 中的 package.json 中指定的 sass-loader?我有点困惑,因为在另一个项目中,我有相同的配置,但 postcss.config.js 中没有其他内容,而且我没有收到有关缺少插件的错误消息。谢谢!

最佳答案

我建议您尝试在控制台中启动 vue ui。之后,在“依赖项”类别中,您必须尝试卸载 CSS 处理器的包,然后重新安装。
可能其中一些软件包已损坏。

https://stackoverflow.com/questions/61030999/

相关文章:

django - 有没有办法在 Django Rest Framework 和 Flutter 应用

react-native - 当应用程序在后台运行时使用振动

typescript - 我如何告诉 SentryWebpackPlugin 我的源映射的名称?

python-3.x - 在 python 中更快地读取大型 xlsb 文件

unity3d - SceneManager LoadScene 在编辑器播放模式下不工作

vue.js - Vue 路由器延迟加载不起作用或创建单独的 block 文件

tensorflow - 转换后的 Tensorflow JS 模型报告缺少输入形状

Angular 8 - POST + 重定向与提交 HTML

完全一样,但不使用 DO

reactjs - 为什么我在 react-native 中的 svg 没有显示任何阴影?

php - 如何使用带有 "grpc_php_plugin"的 PHP 和 Windows 10 的