ERROR Failed to compile with 1 error

 WARNING  Compiled with 1 warning                                                                                                                      23:24:43
 warning  in ./src/main.js

export 'default' (imported as 'store') was not found in './store' (module has no exports)
出现这种报错是因为没有找相关导出store

在src/stoer/index.js中加入导出 export default store 即可

import { createStore } from "vuex"


//vuex 的核心作用就是帮我们管理组件之间的状态的
const store = createStore({
    //所有的状态数据都放在这里(数据)
    state:{
        counter:0
    }
})

export default store

2.想要解决上图的问题,在.eslintrc.js文件中,添加红色框中的代码,就可以解决代码爆红的问题完整报错信息:Parsing error: No Babel config file detected for D:\VuecliWorkspace\vue_test\src\main.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

里面写了使用requireConfigFile:false解决

解决方法: "requireConfigFile":false

 

3,Vue项目中出现error Component name "xxxx" should always be multi-word vue/multi-word-comp报错信息怎么办,直接添加这行代码就行 一、前言 在我们写Vue项目的时候可能会报出这样一个错误:建议修改文

在我们的项目中找到vue.config.js文件,配置改文件,配置信息如下:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false
})

一般有vue.config.js这个文件的只需要添加下面的一行代码就行

lintOnSave:false

4.将这段代码中的this去掉 const handleLogin=()=>{

      this.$store.commit("setCoun",100);

      console.log(store.state.count);

    }

 

 

5,

 

 

ERROR Failed to compile with 1 error的错误信息表明编译过程中出现了一个错误。根据引用中的警告信息,这个错误可能是在主文件(main.js)中的某一行代码中发生的。要解决这个错误,我们需要查看具体的错误信息。 在引用中提到,当在Vue项目中安装了less和less-loader后,重启服务时可能会出现报错。这个报错可能是由于less版本过高导致的。解决方法是降低less版本为合适的版本。 另外,引用中提到了一个Vue项目中出现的错误,错误信息为"Component name 'xxxx' should always be multi-word vue/multi-word-comp"。解决这个错误的方法是给组件名添加多个单词。 综上所述,如果你遇到了ERROR Failed to compile with 1 error的错误,请先查看具体的错误信息并尝试根据错误信息解决问题。另外,如果你在Vue项目中遇到了Component name的错误,请尝试给组件名添加多个单词。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [ERROR Failed to compile with 1 error](https://blog.csdn.net/lv_suri/article/details/126219408)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [解决vue安装less报错Failed to compile with 1 errors的问题](https://download.csdn.net/download/weixin_38667581/14671803)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值