After upgrading to laravel-mix 6, I get this same error with the laravel-provided example vue app.
laravel-mix 5 works fine with the same app.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Uncaught TypeError: Vue.component is not a function . The error is generated in the following line of code
Vue.component('Flash', require('./components/Flash.vue').default);
I am importing Vue on bootstrap.js
window.Vue = require('vue');
I get this error on my console after upgrading the following packages
Old Version Left | New Version Right
"axios": "^0.19.2", => "axios": "^0.21.1",
"resolve-url-loader": "^2.3.1", =>"resolve-url-loader": "^3.1.2",
"laravel-mix": "^4.0.7", => "laravel-mix": "^6.0.0-beta.17"
after upgrading the Laravel mix the following dependencies were installed "vue-loader": "^15.9.5",
Hi, I got to fix the error, maybe you're having the same configuration problem as I did. Here is a solution to try.
These line of code should go directly at the top of your app.js
import Vue from 'vue'
window.Vue = Vue;
require('./bootstrap');
then followed by your components and then create your vue instance
Vue.component('Flash', require('./components/Flash.vue').default);
const app = new Vue({
el: '#app',
router
});
I had the error because the import Vue from 'vue' statement was included in my bootstrap.js and moving it to app.js fixed it. I went ahead to try it on a new laravel project by importing vue in my bootstrap file and then requiring it at the top of app.js and I got the error, I then import vue right there in my app.js followed by the require statement as seen above and the error disappear.
Please or to participate in this conversation.