ERROR  Failed to compile with 1 errors                                                                                                                                                                         10:52:35
 error  in ./node_modules/axios/lib/platform/index.js
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/js/main.js
 @ multi (webpack)-dev-server/client?http://localhost:81 webpack/hot/dev-server ./src/js/main.js
1. 执行下面的安装(注意axios版本要和自己的项目匹配) 
npm uninstall axios
npm install axios@0.19.0 --save
2. vue 中 main.js 引入
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/global.css'
import axios from 'axios'
Vue.prototype.$axios = axios

Vue.use(ElementUI)
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐