error in ./src/main.js报错解决
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报错解决相关推荐
- 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 ...
- npm打包报错ERROR in ./src/main/webapp/app/core解决方法
jenkins用webpack打前端的包,出现报错了,报错还不止一个,8个error,看的我疯狂以为是自己的问题,是不是要用npm下载很多的什么手脚架,插件之类的.. 问题: 主要报错: ERROR ...
- Eclipse中导入项目后js报错解决方法
Eclipse中导入项目后js报错的原因与解决方法 在我们将项目导入Eclipse后,配置好各种编译条件.加载好jar包.配置好tomcat后发现项目还是报错,(前提是项目本身并没有错误,而是我们在初 ...
- 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来玩,造轮子难免会 ...
- 在创建maven项目中出现src/main/java 和src/maim/java 报错解决方法
eclispe在创建maven项目时出现src/main/java 和src/maim/java没有在项目中出现,在通过java Build Path>>source 发现这两个文件有报错 ...
- com.alibaba.druid.sql.parser.ParserException: syntax error, QUES %, pos 80 like报错解决
最近,把各应用的jdbc连接池统一从dbcp2改成了druid,运行时druid报sql解析错误,如下: select * from test where 1=1 ...
- ERROR 1366(HY000)报错解决方法
mysql报错ERROR 1366(HY000) 运行sql语句,报错像这样的ERROR 1366(HY000):Incorrect string value:XXX一堆乱码: 分析: 1.如果单独执 ...
- maven error in opening zip file报错解决
找到报错的jar所在路径,全部删除,重新maven update一下即可. 参考链接:https://blog.csdn.net/tengdazhang770960436/article/detail ...
- composer PHP Fatal error: Allowed memory size of 报错解决
执行以下命令(安装多线程) php composer.phar require hirak/prestissimo 出现以下提示 PHP Fatal error: Allowed memory siz ...
最新文章
- Apache用户认证、域名跳转、Apache访问日志
- c++11の简单线程管理
- Qt中QLabel的背景图片设置问题
- 前端学习(2138):前端工程化
- 【运动快乐】享受赤脚慢跑 收获健康快乐
- c 结构体中的变长数组
- 两种计算器小程序对比
- 如何正确使用日志Log
- 如何遍历或枚举JavaScript对象?
- ajax 请求与响应,实例解读ajax发送请求与数据响应
- 红帽学习笔记[RHCSA] 第六课[进程、服务相关]
- RFID FDX HDX Technology
- shell 命令返回值判断
- Failed to create/setup connection: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。
- 调制深度(modulation depth)是什么?
- HTB打靶(Active Directory 101 Forest)
- 腾讯内部深度文章曝光:微信向左 手机QQ向右
- 电脑版微信多开的方法
- java支付逻辑_java 订单支付status逻辑
- 波特兰书呆子晚餐-在那儿和广场