1.报错场景

我在操作在Vue框架中使用element-ui组件,准备工作已经完成,然后在powershell上运行项目:npm run serve

2.报错详细代码:

 WAIT  Compiling...                                                                                 下午8:34:4098% after emitting CopyPluginERROR  Failed to compile with 1 error                                                              下午8:34:44error  in ./src/main.jsModule Error (from ./node_modules/eslint-loader/index.js):E:\vscode\module\code\vueui\vue_proj_02\src\main.js4:1   error  Expected space or tab after '//' in comment    spaced-comment12:1   error  Expected indentation of 2 spaces but found 4   indent13:1   error  Expected indentation of 2 spaces but found 4   indent14:18  error  Newline required at end of file but not found  eol-last✖ 4 problems (4 errors, 0 warnings)4 errors and 0 warnings potentially fixable with the `--fix` option.Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。尝试新的跨平台 PowerShell https://aka.ms/pscore6

3. 分析:

我开始检查main.js中的引入是否写错,确认无误后,百度说可能是vue和element-ui的版本不一致,我也试了,没成功,最后我在保存main.js中,一直报格式错误,于是我找到了报错的真正原因,我们的.eslintrc.js配置文件,检查我们的页面格式不正确,后来查百度说要默认在最后一行加一个空行,还有就是缩进也要修改,改了确实不报错了,但是一保存,格式又恢复了,真是气死我了,那么我只能解决问题

其实这是马后炮了,我的报错原因也告诉我是格式上的错误,只不过我按照以往的经验,查看的是最初报错的地方,后面的代码没有仔细看,以后需要注意

E:\vscode\module\code\vueui\vue_proj_02\src\main.js4:1   error  Expected space or tab after '//' in comment    spaced-comment12:1   error  Expected indentation of 2 spaces but found 4   indent13:1   error  Expected indentation of 2 spaces but found 4   indent14:18  error  Newline required at end of file but not found  eol-last

4.解决问题:修改根目录中的配置文件

(1):在.eslintrc.js文件中的rules中添加,解决缩进问题
 rules: {//下一行为添加的'indent': ['off', 2],'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off','no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off','eol-last': 0}
(2):在…editorconfig中将insert_final_newline改为false,也要修改在.eslintrc.js文件中的rules中添加规则,注意这两行代码是在不同文件中修改的,这样需要回车问题也解决了
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
//下一行为修改的
insert_final_newline = false
'indent': ['off', 2],'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off','no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',//下一行为添加的'eol-last': 0

error in ./src/main.js报错解决相关推荐

  1. Module not found: Error: Can‘t resolve ‘element-ui‘ in ‘D:ui\t-vue1\src‘ error in ./src/main.js

    日志报错: ERROR Failed to compile with 2 errors 13:42:12error in ./src/main.jsModule not found: Error: C ...

  2. npm打包报错ERROR in ./src/main/webapp/app/core解决方法

    jenkins用webpack打前端的包,出现报错了,报错还不止一个,8个error,看的我疯狂以为是自己的问题,是不是要用npm下载很多的什么手脚架,插件之类的.. 问题: 主要报错: ERROR ...

  3. Eclipse中导入项目后js报错解决方法

    Eclipse中导入项目后js报错的原因与解决方法 在我们将项目导入Eclipse后,配置好各种编译条件.加载好jar包.配置好tomcat后发现项目还是报错,(前提是项目本身并没有错误,而是我们在初 ...

  4. JS报错解决:SyntaxError: Unexpected token 《 in JSON at position 0

    ThinkPHP5.1的环境要求如下: PHP >= 5.6.0 PDO PHP Extension MBstring PHP Extension 最近下载了tp 5.1.19来玩,造轮子难免会 ...

  5. 在创建maven项目中出现src/main/java 和src/maim/java 报错解决方法

    eclispe在创建maven项目时出现src/main/java 和src/maim/java没有在项目中出现,在通过java Build Path>>source 发现这两个文件有报错 ...

  6. com.alibaba.druid.sql.parser.ParserException: syntax error, QUES %, pos 80 like报错解决

    最近,把各应用的jdbc连接池统一从dbcp2改成了druid,运行时druid报sql解析错误,如下: select * from test          where 1=1          ...

  7. ERROR 1366(HY000)报错解决方法

    mysql报错ERROR 1366(HY000) 运行sql语句,报错像这样的ERROR 1366(HY000):Incorrect string value:XXX一堆乱码: 分析: 1.如果单独执 ...

  8. maven error in opening zip file报错解决

    找到报错的jar所在路径,全部删除,重新maven update一下即可. 参考链接:https://blog.csdn.net/tengdazhang770960436/article/detail ...

  9. composer PHP Fatal error: Allowed memory size of 报错解决

    执行以下命令(安装多线程) php composer.phar require hirak/prestissimo 出现以下提示 PHP Fatal error: Allowed memory siz ...

最新文章

  1. c++ 优先队列_什么是队列?(Python队列)
  2. 输入法——讨厌的全角
  3. JZOJ 4822. 【NOIP2016提高A组集训第1场10.29】完美标号
  4. 面试官:“你大学做过真实项目吗?”
  5. 牛客练习赛71E-神奇的迷宫【点分治,NTT】
  6. 大厂面试必问!50w字+的Java技术类校招面试题汇总
  7. win8关闭uefi+linux,UEFI启动是什么?Win8关闭UEFI引导方式的方法
  8. linux java xmx_linux应用实际内存大于 jvm xmx
  9. MongoDB使用经验总结
  10. ehcache缓存原理_Mybatis-09-缓存
  11. mysql505复位密码_MySQL数据库复位根用户的密码_MySQL
  12. 帆软按钮Javascript给某个单元格赋值(例:逻辑删除)
  13. 团队管理(二)-敏捷开发最佳团队协作管理平台(TAPD)
  14. Linear Mixde Model:线性混合模型简介
  15. 数据结构:zyf树/毒瘤树
  16. 商汤科技面试——实习面试案例总结
  17. UVA10306 - e-Coins(二维完全背包)
  18. 《具体数学》部分习题解答4
  19. OneDrive的申请与使用
  20. Oracle Sqlplus命令登录的几种方式

热门文章

  1. 饿了么:云端调度,饭来张口
  2. 21天读书打卡活动第四期招募
  3. 复杂网络建模的实现(哈工大深圳复杂网络建模课程Project)
  4. 白帽SEO是什么?白帽SEO手法有哪些?
  5. 本“徕”就美,Xiaomi 12S 系列原生双画质的修炼秘籍
  6. 面对新技术,这才是软件工程师的正确打开方式
  7. 设计模式 - 结构型设计模式小结
  8. Origin——同时(指数形式)拟合三条曲线(参数共享的全局拟合)
  9. 用计算机做出来的歌,电脑里的歌曲太多,教你快速制作歌曲目录
  10. 奋斗吧,程序员——第四章 人生若只如初见,何事秋风悲画扇