2

我试图安装 vuetify 但它给了我这个错误:

[VuetifyLoaderPlugin Error] No matching rule for vue-loader found.
Make sure there is at least one root-level rule that uses vue-loader and VuetifyLoaderPlugin is applied after VueLoaderPlugin.

包.json:

{
 "name": "vueapp",
 "version": "0.1.0",
 "private": true,

"scripts": {

    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },

  "dependencies": {

    "core-js": "^3.6.5",
    "vue": "^3.0.0",
    "vuetify": "^2.4.0"
  },

  "devDependencies": {

    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0",
    "sass": "~1.32.0",
    "sass-loader": "^10.0.0",
    "vue-cli-plugin-vuetify": "~2.4.1",
    "vuetify-loader": "^1.7.0"
        
  },

  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/vue3-essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

我正在使用 Vue 版本 6.14.13、@vue/cli 4.5.13 和 yarn 版本 1.22.10。我试图更改 package.json 中的依赖项,但它似乎不起作用。

错误

4

3 回答 3

2

我遇到了同样的问题。我从 devDependancies 中删除了 "vuetify-loader": "^1.7.0" 并且它起作用了。

于 2021-10-03T22:58:26.577 回答
0

我也遇到了同样的错误。然而,在经历了很多麻烦之后,最好的答案是使用“yarn create nuxt-app”命令重新创建应用程序的基础。然后覆盖所需的源。nuxt.config.js 可能需要仔细合并设置。

于 2022-02-27T15:17:18.197 回答
0

在 webpack.mix.js 中改变这个:

mix.js('resources/js/app.js', 'public/js').sass('resources/sass/app.scss', 'public/css').sourceMaps();

进入这个:

mix.js('resources/js/app.js', 'public/js').vue().sass('resources/sass/app.scss', 'public/css').sourceMaps();
于 2022-01-24T03:55:21.240 回答