search

Home  >  Q&A  >  body text

Analyze the problems encountered when importing axios and vue in vite

I am using Vue.js and Vite to create a project and encountered a problem when running.

[plugin:vite:import-analysis] 无法解析从“srccomponentsStudent.vue”中的导入“axios”。文件是否存在?

What I have tried is shown below. I have installed npm i axios, but why do I get this error and also imported import axios from 'axios';

<script>
    import Vue from 'vue';
    import axios from 'axios';
		Vue.use(axios)
</script>
		 
P粉545910687P粉545910687497 days ago618

reply all(1)I'll reply

  • P粉578680675

    P粉5786806752023-08-16 12:22:55

    You forgot to install axios. Try executing npm install axios --save

    reply
    0
  • Cancelreply