TypeError:Vue.component不是函数laravel项目

时间:2018-09-20 01:33:19

标签: laravel vue.js axios

这似乎是一个持续存在的问题。我到处搜寻解决方案,但都没有成功。我只是从控制台发布确切的错误消息:

app.js:34588 Uncaught TypeError: Vue.component is not a function
at Object.supportsPassive (app.js:34588)
at __webpack_require__ (app.js:20)
at Object.<anonymous> (app.js:12599)
at __webpack_require__ (app.js:20)
at Object.defineProperty.value (app.js:12588)
at __webpack_require__ (app.js:20)
at app.js:63
at app.js:66

现在是我的package.json:

 "devDependencies": {
    "axios": "^0.18.0",
    "cross-env": "^5.2.0",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.5",
    "popper.js": "^1.12",
    "vue": "^2.5.7"
},
"dependencies": {
    "vee-validate": "^2.1.0-beta.9",
    "vue-router": "^3.0.1",
    "vuetify": "^1.2.3",
    "vuex": "^3.0.1"
}

app.js

import Vue from 'vue'
import './plugins/bootstrap'
import './plugins/vuetify'
import router from './plugins/routes'

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */
// Vue.component('entry', require('./pages/Home.vue'));

const app = new Vue({
    el: '#app',
    router
});

1 个答案:

答案 0 :(得分:0)

我正在对 laravel 7 项目进行一些依赖更新,它开始在 vue 编译视图上看到此错误。我改变了Vue包调用:

<块引用>

使用 import Vue from 'vue' 而不是 window.Vue = require("vue"); 对我有用。