wdlhao / vue2-element-touzi-admin

基于vue2.0 +vuex+ element-ui后台管理系统
4.2k stars 1.51k forks source link

npm i 安装后 npm run serve 就报错了,这是什么情况 #73

Open favoriteWS opened 1 year ago

favoriteWS commented 1 year ago

Starting development server... ERROR Error: Rule can only have one resource source (provided resource and test + include + exclude) in { "exclude": [ null ], "use": [ { "loader": "cache-loader", "options": { "cacheDirectory": "D:\desk\vue2-element-touzi-admin\node_modules\.cache\babel-loader", "cacheIdentifier": "a5ed1dd2" }, "ident": "clonedRuleSet-38.use[0]" }, { "loader": "babel-loader", "options": "undefined", "ident": "undefined" } ] } Error: Rule can only have one resource source (provided resource and test + include + exclude) in { "exclude": [ null ], "use": [ { "loader": "cache-loader", "options": { "cacheDirectory": "D:\desk\vue2-element-touzi-admin\node_modules\.cache\babel-loader", "cacheIdentifier": "a5ed1dd2" }, "ident": "clonedRuleSet-38.use[0]" }, { "loader": "babel-loader", "options": "undefined", "ident": "undefined" } ] } at checkResourceSource (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:167:11) at Function.normalizeRule (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:198:4) at D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:110:20 at Array.map () at Function.normalizeRules (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:109:17) at new RuleSet (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:104:24) at new NormalModuleFactory (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModuleFactory.js:115:18) at Compiler.createNormalModuleFactory (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:636:31) at Compiler.newCompilationParams (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:653:30) at Compiler.compile (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:661:23) at D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Watching.js:77:18 at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\tapable\lib\HookCodeFactory.js:33:10), :24:1) at AsyncSeriesHook.lazyCompileHook (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\tapable\lib\Hook.js:154:20) at Watching._go (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Watching.js:41:32) at D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Watching.js:33:9 at Compiler.readRecords (D:\desk\vue2-element-touzi-admin\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:529:11)

jack13163 commented 1 year ago

您好!    您的邮件已送到,我会及时答复,请耐心等待!

dubianzhenxia commented 1 year ago

这个错误是webpack5的原因,似乎要用4.46.0以下版本,把package.json换成下面的内容(除了限制webpack版本,还降低了几个依赖冲突的版本),然后删除package-lock.json和node_modules,重新npm i,就可以成功运行了,不过nodejs版本不能过高,不然还会报错,用作者推荐的10.9.0版本可以正常运行。不过做了这些修改不确定项目中所有功能是否有影响。

{
  "name": "vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "dev": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "build:prod": "vue-cli-service build --mode production",
    "build:dev": "vue-cli-service build --mode development",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.21.2",
    "core-js": "^2.6.9",
    "echarts": "^5.4.0",
    "element-ui": "^2.11.1",
    "express": "^4.17.1",
    "js-cookie": "^2.2.1",
    "mockjs": "^1.0.1-beta3",
    "nprogress": "^0.2.0",
    "qrcodejs2": "0.0.2",
    "vue": "^2.6.10",
    "vue-i18n": "^8.14.0",
    "vue-router": "^3.1.2",
    "vuex": "^3.1.1",
    "webpack": "4.44.2"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/plugin-transform-runtime": "^7.5.5",
    "@babel/preset-env": "^7.5.5",
    "@vue/cli-plugin-babel": "^3.11.0",
    "@vue/cli-plugin-eslint": "^3.11.0",
    "@vue/cli-service": "^3.11.0",
    "babel-eslint": "^10.0.2",
    "compression-webpack-plugin": "^4.0.0",
    "image-webpack-loader": "^8.1.0",
    "less": "^4.1.3",
    "less-loader": "^7.3.0",
    "terser-webpack-plugin": "^4.0.0",
    "css-loader": "^4.0.0",
    "vue-hot-reload-api": "^2.3.3",
    "vue-loader": "^15.7.1",
    "vue-template-compiler": "^2.6.10",
    "webpack-bundle-analyzer": "^4.7.0"
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}
jack13163 commented 1 year ago

您好!    您的邮件已送到,我会及时答复,请耐心等待!