Registry / devops / axios-vue

axios-vue

JSON →
library0.1.3jsnpmunverified

A lightweight Vue.js plugin that integrates Axios as a global Vue plugin, adding $http and $axios properties to Vue instances and components. Version 0.1.3, last updated in 2017, no active releases. Differentiators include simple installation via Vue.use() and support for global defaults and interceptors in options. However, it is outdated, not compatible with Vue 3, and relies on Vue 2's plugin system. Alternatives include vue-axios (updated) and direct Axios usage.

npm install axios-vue
INSTALL
IMPORT
SIG · AXIOS-VUE
A
axios-vue
devopsjavascriptv0.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

axiosVue
import axiosVue from 'axios-vue'
const axiosVue = require('axios-vue')
Default import only; package does not export named members.
Vue
import Vue from 'vue' import axiosVue from 'axios-vue' Vue.use(axiosVue)
Vue.use(require('axios-vue').default)
Must use Vue.use() to install; Vue 2 required.
$http
this.$http.get('/api') // inside Vue component
Vue.prototype.$http.get('/api')
Access via component instance or Vue constructor after Vue.use()

Demonstrates installation and usage of axios-vue with global defaults and a response interceptor.

import Vue from 'vue'; import axiosVue from 'axios-vue'; Vue.use(axiosVue, { globalDefaults: { baseURL: 'https://api.example.com', }, interceptors: { response(response) { return response; }, }, }); new Vue({ el: '#app', created() { this.$http.get('/data') .then(res => console.log(res)) .catch(err => console.error(err)); }, });
Debug
Known issues
breakingaxios-vue uses Vue 2 plugin system and is not compatible with Vue 3.
fix
Use vue-axios or native Axios with Vue 3 (Composition API).
affects: >=3.0
gotchaOverwriting interceptors via both outer functions and options can lead to unexpected behavior; options take precedence.
fix
Use only one method of defining interceptors (prefer options).
affects: >=0.0
gotcha`this.$http()` and `this.$axios()` are added to Vue.prototype, which may conflict with other plugins or Vue 3's lack of prototype injection.
fix
Check for naming conflicts; in Vue 3, use provide/inject or direct Axios imports.
affects: >=0.0
deprecatedPackage is outdated (last release 2017) and has known security vulnerabilities in its dependencies.
fix
Switch to actively maintained packages like vue-axios or axios itself.
affects: >=0.0
Errors
Common errors & fixes
Cannot use '$http' outside of Vue components with vue 2?
Trying to access this.$http in a non-component context or before Vue.use().
fix
Ensure Vue.use(axiosVue) is called before creating any Vue instances; access via Vue.$http on the constructor if needed.
TypeError: Cannot read property 'get' of undefined
axios-vue not properly installed or Vue instance not yet created.
fix
Run Vue.use(axiosVue) in your app entry file before new Vue().
'axios-vue' is not compatible with Vue 3
Package only supports Vue 2's plugin system (Vue.use()).
fix
Use vue-axios or install axios directly and use Composition API functions.
require is not defined
Using CommonJS require in a frontend project with ESM bundler (e.g., Webpack, Vite).
fix
Use import statement: import axiosVue from 'axios-vue'. Ensure your bundler is configured for ESM.
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies
axiosrequiredcore HTTP client dependency
vuerequiredpeer dependency for Vue plugin system
Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
axios-vue — npm install axios-vue · libregistry