Parsing error: Unexpected token < at ... Vue CL

在使用vue cli3的时候,遇到如下问题:

error: Parsing error: Unexpected token < at src\views\index.vue:1:1:

  1 | <template>
    | ^
  2 |   <div class="index">
  3 |     <router-view></router-view>
  4 |     <TabBar :data="tabbarData"></TabBar>

查阅了许多网站,都不能解决此问题,最后,在

https://stackoverflow.com/questions/53601579/parsing-error-unexpected-token-using-vuecli3-and-airbnb-eslint?r=SearchResults

找到了办法

打开你的 .eslintrc.js 文件,找到 parser

这是我的 .eslintrc.js

module.exports = {
    rules: {
        'no-console': 'off',
        "parser": "vue-eslint-parser",
        "parserOptions": {
           "ecmaVersion": 7,
           "sourceType": "module"
        }
    },
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。