Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
$axios
✓ this.$axios.get('/api/data')
After installing the plugin, `this.$axios` becomes available on Vue instances for global HTTP requests in Vue 2 (Options API).
axios
✓ import axios from 'axios'; axios.post('/api/submit', data);
Standard way to import Axios directly in any module or component, especially in Vue 3 Composition API or for local instances.
Vue.axios
✓ Vue.axios.get('/api/users');
✗ Vue.prototype.$axios.get('/api/users');
The plugin also typically exposes `Vue.axios` directly. Accessing via `Vue.prototype.$axios` is how it's often set up under the hood but not the intended direct usage.
This quickstart demonstrates the typical installation command for a Vue CLI plugin and how `this.$axios` would be used in a Vue component after the plugin globally attaches Axios. It also shows a modern, manual global Axios setup for Vue 3, as the plugin itself is deprecated.
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
// Assuming vue-cli-plugin-axios was added to a Vue CLI 3 project (Vue 2 or 3 compatible at the time)
// This plugin typically modifies `main.js` or creates a plugin file like `src/plugins/axios.js`.
// The core part of the plugin injects Axios globally.
// Example of what the plugin would achieve (simplified representation):
import axios from 'axios';
const app = createApp(App);
// If using Vue 2 with this plugin, it would be Vue.use(Plugin, axios)
// For Vue 3, if the plugin were updated, it might use globalProperties
// (This specific plugin is for Vue CLI 3, often used with Vue 2, or early Vue 3 setup)
// Manual global Axios setup for modern Vue 3 (alternative to old plugin):
app.config.globalProperties.$axios = axios;
app.config.globalProperties.$http = axios;
app.use(store);
app.use(router);
app.mount('#app');
// Example component usage in a .vue file (Options API for Vue 2, compatible with plugin's intent):
/*
<template>
<div>
<button @click="fetchData">Fetch Data</button>
<pre>{{ responseData }}</pre>
</div>
</template>
<script>
export default {
data() {
return {
responseData: null,
error: null,
};
},
methods: {
async fetchData() {
try {
const result = await this.$axios.get('https://jsonplaceholder.typicode.com/todos/1');
this.responseData = result.data;
} catch (e) {
this.error = e;
console.error('Error fetching data:', e);
}
},
},
};
</script>
*/
Debug
Known issues
breakingThe package `vue-cli-plugin-axios` is effectively abandoned (last update over 5 years ago) and targets Vue CLI 3, which is now in maintenance mode. For new projects, Vue CLI has been superseded by Vite, and this plugin is not compatible with Vite-based setups.fixFor new Vue 3 projects, use `create-vue` to scaffold a Vite project. Install `axios` directly via `npm install axios` and import it locally, or manually attach it to `app.config.globalProperties`.
affects: All versions
deprecatedGlobal injection of Axios via `Vue.prototype.$axios` (as done by this plugin) is generally discouraged in modern Vue 3 for better type inference and testability. The Composition API favors local imports or providing/injecting instances.fixPrefer `import axios from 'axios'` in components or utility files. If global access is necessary in Vue 3, use `app.config.globalProperties.$axios = axios` during app creation, and then access with `getCurrentInstance().appContext.config.globalProperties.$axios` in setup or `this.$axios` in Options API.
affects: All versions
breakingThe upstream `axios` package itself experienced a significant supply chain attack on March 31, 2026, affecting versions `1.14.1` and `0.30.4`. These versions contained malicious code.fixImmediately roll back any deployments using affected Axios versions. Pin `axios` to safe versions (`1.14.0` or `0.30.3` or earlier) or update to patched versions if available. Flush local npm caches (`npm cache clean --force`). Review CI/CD logs for `npm install` executions that might have picked up these versions.
affects: axios@1.14.1, axios@0.30.4
Errors
Common errors & fixes
error: 'options' is defined but never used (no-unused-vars) at src/plugins/axios.js
After installing `vue-cli-plugin-axios`, ESLint flags the `options` parameter in the generated plugin file (`src/plugins/axios.js`) as unused, indicating a linting issue with the plugin's boilerplate.
fixEdit `src/plugins/axios.js` (or similar plugin file) and remove the `options` parameter from the `Plugin.install` function signature. Change `Plugin.install = function(Vue, options) {` to `Plugin.install = function(Vue) {`. TypeError: Cannot read properties of undefined (reading '$axios')
Attempting to access `this.$axios` in a Vue component before the `vue-cli-plugin-axios` (or an equivalent global plugin) has correctly registered Axios with the Vue instance, or if using Vue 3 without explicitly attaching it to `globalProperties`.
fixEnsure the plugin is correctly installed and registered in your `main.js` (or `main.ts`). For Vue 3, ensure `app.config.globalProperties.$axios = axios` is set if you intend to use `this.$axios`. Verify that Axios itself is installed (`npm install axios`).
Audit
Dependencies
axiosrequiredCore HTTP client library this plugin integrates.
@vue/cli-servicerequiredRuntime dependency for Vue CLI projects, which this plugin modifies. It's an implicit peer dependency.