首页 > 其他分享 >Vue 中引入 axios 后报错

Vue 中引入 axios 后报错

时间:2024-02-23 15:33:35浏览次数:25  
标签:node 1.5 axios modules js Vue 报错

vue报错:Module parse failed: Unexpected token (5:2)You may need an appropriate loader to handle this

具体错误信息如下:

Module parse failed: Unexpected token (5:2)
You may need an appropriate loader to handle this file type.
| 
| export default {
|   ...utils,
|   ...platform
| }

 @ ./node_modules/axios/lib/defaults/index.js 8:0-44
 @ ./node_modules/axios/lib/axios.js
 @ ./node_modules/axios/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

版本冲突,一般下载axios默认下载的是最新版本1.6.2,而我们只需要将axios的版本改为1.5.0即可

解决:

1、先卸载原来的:npm uni axios

2、安装新的:npm install [email protected] --save

 

标签:node,1.5,axios,modules,js,Vue,报错
From: https://www.cnblogs.com/youxl189/p/18029530

相关文章

  • Python打开https链接报错:unable to get local issuer certificate
    Python打开https链接报错:unabletogetlocalissuercertificate或安装Python3.10以上版本,需要openssl1.1.1以上版本,会导致openssl下面缺少证书,记录下安装方法问题描述:当使用urllib.urlopen打开一个https链接时抛出如下异常:urllib.error.URLError:<urlopenerror[SSL:......
  • windows11系统下ppt突然打不开,报错“PowerPoint启动时提示上次启动失败是否启用安全模
    问题描述:windows11系统下ppt突然打不开,报错:PowerPoint启动时提示上次启动失败是否启用安全模式...ppt文件是正常的,我发到其他设备上是可以正常打开的。我把office卸载了用腾讯文档也无法打开ppt文件。点击用安全模式打开后无反应,即无错误提示也没有打开ppt。以上情况说明:......
  • Vue动态组件
    components简介在不同组件之间进行动态切换Vue的元素加一个特殊的【is】属性来实现多个组件使用同一个挂载点,之后动态在各个组件之间切换内置组件keep-alivekeep-alive动态组件默认每次切换都会销毁组件并重新创建,这样会影像性能使用keep-alive组件缓存非活动组件,可以保留......
  • 遇到Failed to get response from https://registry.npm.taobao.org/vue-cli-version-
    1.问题在启动vueui时,总是遇到报错,如下图:2.解决参考:vuecli创建项目报错:Failedtogetresponsefrom/vue-cli-version-marker找到你的.vuerc文件:C:\Users\trmbh\.vuerc,这里根据自己的用户名更改然后改为{"useTaobaoRegistry":false,"packageManager":"npm"}第......
  • vue3 ref 获取单个Dom及多个Dom
    获取单个Dom<inputtype="text"ref="inputRef"/>setup(){constinputRef=ref(null)onMounted(()=>{console.log(inputRef.value);})}获取多个Dom<divv-for="(item,index)instate.list":key=&quo......
  • 查询pytest --version报错 AttributeError: module ‘collections‘ has no attribute
     卸载pytest及关联的插件先查询一下pytest及对应关联的插件 pipuninstallcoloramaexceptiongroupiniconfigpackagingpluggytomliallure-pytestpytest-allure-adaptorpytest回车,每次都回复Y,同意卸载 再重新安装pytestpipinstallpytest-ihttp://pypi.douba......
  • vue3+vite 移动端适配postcss-pxtorem插件
    1、安装插件npmipostcss-pxtorem-D2、与package.json同级目录创建postcss.config.js文件module.exports={plugins:{autoprefixer:{overrideBrowserslist:["Android4.1","iOS7.1",......
  • 【Unity】ScriptableObject使用之后,重新打开Unity会报错
    导致问题出现的原因:ScriptableObject的类与其他类放一起了具体请见:unity2020.3官方文档ScriptableObject部分解决方法:为ScriptableObject单独创建一个c#脚本,并将c#名称与ScriptableObject类名保持一致。猜测出现这样的原因,如果哪里不对烦请大佬指正一下:Unity中基本上都是会通......
  • ssts-hospital-web-master项目实战记录十:master-*.vue组件实现
    记录时间:2024-02-23Master_Basic.html<!DOCTYPEhtml><htmlxmlns="http://www.w3.org/1999/xhtml"><head>  <title>主页</title>  <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"......
  • ssts-hospital-web-master项目实战记录九:父组件App.vue给子组件main-page*.vue传值ter
    记录时间:2024-02-23一、App.vue详见:App.vue组件实现 【使用“文心一言”提取组件传值逻辑说明和代码】在Vue3中,组件传值通常涉及到props、emits、slots和组件的引用。在提供的代码中,主要关注点是动态组件的渲染和通过props传递数据。下面是对组件传值逻辑的说明和代码......