[Vuejs]-Uncaught ReferenceError: Vue is not defined at room.js:109

0๐Ÿ‘

ReferenceError: Vue is not defined at room.js:109

Just place the <script> that loads Vue before the one that loads your app (room.js):

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js"></script>
<script type="text/javascript" src="room.js"></script>

This simple re-ordering does eliminate the error message you complain about: https://plnkr.co/edit/d4onGB56dTpfOHrHm34c?p=preview

โ€œit still has the same problemโ€œ

You have to realize that in the current state, you still execute your room.js script before the browser has parsed your HTML <body>, hence there is no DOM yet, and new Vue({el: '#app'}) will not find anything to attach to.

Either have the new Vue call delayed after DOM is ready, or simply move your <script> tags to the end of your <body>: https://plnkr.co/edit/lTziUUiE7egVr1IaynpL?p=preview

See e.g. Invariant Violation: _registerComponent(โ€ฆ): Target container is not a DOM element

Leave a comment