Skip to content

问题:Error: Rule can only have one resource source (provided resource and test + include + exclude)

原因分析:
package.json中webpack版本冲突问题。

解决方案:
删除webpack,重新装以前的版本。

npm uninstall webpack
npm install webpack@^4.0.0 --save-dev

Syntax Error: TypeError: this.getOptions is not a function

说明:scss-loader 版本太高,卸载安装低版本即可

npm uninstall sass-loader
npm install sass-loader@7.3.1 --save-dev
npm i -D sass

也可能报错:
Syntax Error: Error: Node Sass version 7.0.1 is incompatible with ^4.0.0

Uncaught TypeError: marked is not a function

解决:回退到版本3.0.8

npm uninstall marked
npm install marked@3.0.8

vue : 无法加载文件 D:\compilers\nodeJS\node_global\vue.ps1,因为在此系统上禁止运行脚本。

原因:是PowerShell的执行政策阻止了该操作。

解决:

  • 使用get-ExecutionPolicy查看执行策略为受阻状态
    • $ get-ExecutionPolicy

      Restricted

  • 然后使用set-ExecutionPolicy这个指令来更改执行策略
    • Set-ExecutionPolicy -Scope CurrentUser

      请为以下参数提供值:
      ExecutionPolicy:

  • 此时将执行策略的状态改为:RemoteSigned
    • 请为以下参数提供值:
      ExecutionPolicy: RemoteSigned

  • 执行策略的状态已经改变了,我们可以使用get-ExecutionPolicy指令再次查看
    • get-ExecutionPolicy

      RemoteSigned

  • 操作完成,问题解决!

Component name "index" should always be multi-word.eslintvue/multi-word-comp

这个错误是由 ESLint 插件 vue/multi-word-component 规定的,它要求在 Vue.js 项目中定义组件时组件的名称应该是多单词的。

解决方法:

允许使用单个单词命名文件

  • .eslintrc
json
{
  "rules": {
    "vue/multi-word-component-names": "off"
  }
}