0

I recently ran an npm update on my Vue/Laravel app just to upgrade my version of Bulma. Of course, this brought up a dozen vulnerabilities which I decided to fix, and of course this screwed up my whole app, mainly thanks to Webpack and Mix issues. I finally got it everything to compile again with only a few SASS warnings, but when I run the app I get the following error:

Uncaught TypeError: Vue.use is not a function

Google seems to suggest this is a problem when upgrading to Vue 3, however I am still on Vue 2 (2.6). Here's my app.js:

require('./bootstrap');

import VueRouter from 'vue-router';
import router from './router/routes';
import VueConfirmDialog from 'vue-confirm-dialog'
import SkeletonBox from './components/shared/SkeletonBox.vue'
import ValidationErrors from './components/shared/ValidationErrorComponent.vue'

import Vuex from 'vuex';
import storeDefinition from './store'

import Index from './Index'

window.Vue = require('vue');

Vue.use(VueConfirmDialog);

// init the Router
Vue.use(VueRouter);

// Init the Vuex store
Vue.use(Vuex);
const store = new Vuex.Store(storeDefinition);


Vue.component("skeleton-box", SkeletonBox)
Vue.component("v-errors", ValidationErrors)

const app = new Vue({
    el: '#app',
    router,
    store,
    publicPath: './',
    components:{
        "index": Index
    },
    beforeCreate(){
        // call loadStoredState action in store.js
        this.$store.dispatch('loadStoredState');
    }
});

I have absolutely no idea what I need to do to get this working - can anyone help?

ElendilTheTall
  • 1,344
  • 15
  • 23
  • Maybe you are running vue3 but you don't know it ... have a look here: https://stackoverflow.com/questions/71021767/window-vue-use-is-not-a-function-error-on-a-vue2-project – mahatmanich Apr 13 '22 at 10:14
  • In package.json I'm using `"^2.6.11"`. Would that install v3? @mahatmanich – ElendilTheTall Apr 13 '22 at 10:20
  • Normally it should not. Try and see with npm list and npm list -g what packages you are actually using. https://stackoverflow.com/questions/10972176/find-the-version-of-an-installed-npm-package – mahatmanich Apr 13 '22 at 10:49
  • Also try to remove node_modules and rerun from scratch. Maybe there is a hickup between updated modules and old modules that still exist in that folder. Deleting node_modules and using the current package.json to pull in all the required modules might fix that issue. – mahatmanich Apr 13 '22 at 10:56

0 Answers0