报错信息
Failed to compile.
./src/components/Vcontent.vue
Module Error (from ./node_modules/eslint-loader/index.js):
C:\myvue\src\components\Vcontent.vue
4:15 error Parsing error: unexpected-character-in-attribute-name vue/no-parsing-error
4:37 error Parsing error: unexpected-character-in-attribute-name vue/no-parsing-error
? 2 problems (2 errors, 0 warnings)
第一步:初始化并重新安装eslint
npm init -y
npm i eslint@7 -D //版本不能太高,不然容易出现报错Environment key "es2021" is unknown
第二步:进入node_modules下的bin目录,并初始化eslint
cd ./node_modules/.bin/
eslint --init
第三步:设置配置选项,除选择vue.js外,其他都选择默认项或者y
? How would you like to use ESLint? To check syntax and find problems
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? Vue.js
第四步:将node_modules目录下的bin目录里面的.eslintrc.js文件复制到项目的根目录下,覆盖原来的文件
第五步:重新启动服务
npm run serve