Irm*_*ere 3 node.js npm webpack vue.js
我对 Vue 和 Node 是全新的,我正在学习的 Vue3 项目一切都很顺利。我想使用 scss 文件,因此通过 npm 安装 sass-loader 使用:
npm install sass-loader sass webpack --save-dev
从那时起,该应用程序就损坏了,现在当我尝试提供服务时,出现以下错误:
     Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
  "exclude": [
    null
  ],
  "use": [
    {
      "loader": "C:\\pathtoapp\\node_modules\\cache-loader\\dist\\cjs.js",
      "options": {
        "cacheDirectory": "C:\\pathtoapp\\node_modules\\.cache\\babel-loader",
        "cacheIdentifier": "43be597c"
      },
      "ident": "clonedRuleSet-38.use[0]"
    },
    {
      "loader": "C:\\pathtoapp\\node_modules\\babel-loader\\lib\\index.js",
      "options": "undefined",
      "ident": "undefined"
    }
  ]
}
Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
  "exclude": [
    null
  ],
  "use": [
    {
      "loader": "C:\\pathtoapp\\node_modules\\cache-loader\\dist\\cjs.js",
      "options": {
        "cacheDirectory": "C:\\pathtoapp\\node_modules\\.cache\\babel-loader",
        "cacheIdentifier": "43be597c"
      },
      "ident": "clonedRuleSet-38.use[0]"
    },
    {
      "loader": "C:\\pathtoapp\\node_modules\\babel-loader\\lib\\index.js",
      "options": "undefined",
      "ident": "undefined"
    }
  ]
}
我查了一下这个错误,大多数人认为这是 webpack 的问题,但我已经卸载并重新安装了。安装了较早版本的 webpack,尝试更改 package.json 以指向较早版本,尝试了我目前可以在 SO 上找到的任何内容,现在我完全被难住了。
对此的任何帮助将不胜感激,因为我宁愿学习和发现如何解决问题,如果我再次遇到它,而不是简单地开始一个新项目。让我知道我应该在需要时在编辑中发布的任何代码/文件。
我遇到了同样的问题,我能够通过以下方式解决它:
rm -rf node_modules
rm package-lock.json
npm install --legacy-peer-deps
| 归档时间: | 
 | 
| 查看次数: | 2921 次 | 
| 最近记录: |