0

I know there have lots of similar questions of this but I couldn't find a solution from those.

Already installed npm of vue and successfully compiled using npm run dev, I don't know why it return this kind of error below.

ReferenceError: Vue is not defined

This is my setup in my app.js:

import Vue from 'vue';
import VueRouter from 'vue-router';

window.Vue = Vue;
Vue.use(VueRouter);

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

In my welcome.blade.php

<html>
    <head>
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <link href="{{ mix('css/app.css') }}" rel="stylesheet">
    </head>

    <body>
        <div id="app">
            <button class="btn btn-primary">Sample</button>
        </div>

        <script src="{{ mix('js/manifest.js') }}"></script>
        <script src="{{ mix('js/vendor.js') }}"></script>
        <script src="{{ mix('js/app.js') }}"></script>
    </body>
</html>

Someone knows where I went wrong?

5
  • try to add below in bootstrap.js window.Vue = require('vue'); Commented Mar 16, 2020 at 5:10
  • @Sehdev done already with that Sir but still error appears. Commented Mar 16, 2020 at 5:12
  • try npm install Commented Mar 16, 2020 at 5:45
  • @charles try running npm run production Commented Mar 16, 2020 at 5:49
  • @AdnanMumtaz still not working Sir Commented Mar 16, 2020 at 5:53

1 Answer 1

0

I'm curious on what's inside your bootstrap.js. Maybe can you show us, might you import something that is using Vue, on which apparently fail to import.

Sign up to request clarification or add additional context in comments.

1 Comment

exactly! I import my customed Form.js inside bootstrap.js. thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.