zoukankan      html  css  js  c++  java
  • Parsing error: Unexpected token < at ... Vue CLI3

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

    error: Parsing error: Unexpected token < at srcviewsindex.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"
        },
    }

    注意:

      当我写入 import 时,就会报上述错误,这个时候,只需要把 .eslintrc.js 里的 

    "parser": "vue-eslint-parser" 注释掉,重新启动项目。然后,取消掉注释,再次重启项目,就没有报错了。

    为什么会这样,我也不理解。如果你们有了更好的解决办法,麻烦给我留言,谢谢!!!
  • 相关阅读:
    python基本数据类型剖析
    常用正则表达式
    python_re模块
    迭代器模式
    状态模式
    备忘录模式
    asp.net 发送邮件
    建造者模式
    抽象工厂模式
    摸板模式与钩子
  • 原文地址:https://www.cnblogs.com/yanglang/p/13615586.html
Copyright © 2011-2022 走看看